44 lines
3.3 KiB
Plaintext
44 lines
3.3 KiB
Plaintext
%YAML 1.1
|
|
%TAG !u! tag:unity3d.com,2011:
|
|
--- !u!114 &11400000
|
|
MonoBehaviour:
|
|
m_ObjectHideFlags: 0
|
|
m_CorrespondingSourceObject: {fileID: 0}
|
|
m_PrefabInstance: {fileID: 0}
|
|
m_PrefabAsset: {fileID: 0}
|
|
m_GameObject: {fileID: 0}
|
|
m_Enabled: 1
|
|
m_EditorHideFlags: 0
|
|
m_Script: {fileID: 11500000, guid: a0e5d060f45ca564cba1173332d781d0, type: 3}
|
|
m_Name: VectorElement
|
|
m_EditorClassIdentifier:
|
|
Body: "using TARGET = {COMPONENT_FULL};\r\n\r\nnamespace Lean.Transition.Method\r\n{\r\n\t///
|
|
<summary>This component allows you to transition the {COMPONENT}'s {PROPERTY}.{ELEMENT}
|
|
value.</summary>\r\n\t[UnityEngine.HelpURL(LeanTransition.HelpUrlPrefix + \"Lean{TITLE}\")]\r\n\t[UnityEngine.AddComponentMenu(LeanTransition.MethodsMenuPrefix
|
|
+ \"{COMPONENT}/{COMPONENT}.{PROPERTY}.{ELEMENT}\" + LeanTransition.MethodsMenuSuffix
|
|
+ \"(Lean{TITLE})\")]\r\n\tpublic class Lean{TITLE} : LeanMethodWithStateAndTarget\r\n\t{\r\n\t\tpublic
|
|
override System.Type GetTargetType()\r\n\t\t{\r\n\t\t\treturn typeof(TARGET);\r\n\t\t}\r\n\r\n\t\tpublic
|
|
override void Register()\r\n\t\t{\r\n\t\t\tPreviousState = Register(GetAliasedTarget(Data.Target),
|
|
Data.Value, Data.Duration, Data.Ease);\r\n\t\t}\r\n\r\n\t\tpublic static LeanState
|
|
Register(TARGET target, float value, float duration, LeanEase ease = LeanEase.Smooth)\r\n\t\t{\r\n\t\t\tvar
|
|
state = LeanTransition.SpawnWithTarget(State.Pool, target);\r\n\r\n\t\t\tstate.Value
|
|
= value;\r\n\t\t\t\r\n\t\t\tstate.Ease = ease;\r\n\r\n\t\t\treturn LeanTransition.Register(state,
|
|
duration);\r\n\t\t}\r\n\r\n\t\t[System.Serializable]\r\n\t\tpublic class State
|
|
: LeanStateWithTarget<TARGET>\r\n\t\t{\r\n\t\t\t[UnityEngine.Tooltip(\"The {PROPERTY}
|
|
value will transition to this.\")]\r\n\t\t\t{FSA}{ATTRIBUTE}public float Value{DEFAULT};\r\n\r\n\t\t\t[UnityEngine.Tooltip(\"This
|
|
allows you to control how the transition will look.\")]\r\n\t\t\tpublic LeanEase
|
|
Ease = LeanEase.Smooth;\r\n\r\n\t\t\t[System.NonSerialized] private float oldValue;\r\n\r\n\t\t\tpublic
|
|
override int CanFill\r\n\t\t\t{\r\n\t\t\t\tget\r\n\t\t\t\t{\r\n\t\t\t\t\treturn
|
|
Target != null && Target.{PROPERTY}.{ELEMENT} != Value ? 1 : 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tpublic
|
|
override void FillWithTarget()\r\n\t\t\t{\r\n\t\t\t\tValue = Target.{PROPERTY}.{ELEMENT};\r\n\t\t\t}\r\n\r\n\t\t\tpublic
|
|
override void BeginWithTarget()\r\n\t\t\t{\r\n\t\t\t\toldValue = Target.{PROPERTY}.{ELEMENT};\r\n\t\t\t}\r\n\r\n\t\t\tpublic
|
|
override void UpdateWithTarget(float progress)\r\n\t\t\t{\r\n\t\t\t\tvar vector
|
|
= Target.{PROPERTY};\r\n\t\t\t\t\r\n\t\t\t\tvector.{ELEMENT} = UnityEngine.Mathf.LerpUnclamped(oldValue,
|
|
Value, Smooth(Ease, progress));\r\n\t\t\t\t \r\n\t\t\t\tTarget.{PROPERTY} = vector;\r\n\t\t\t}\r\n\r\n\t\t\tpublic
|
|
static System.Collections.Generic.Stack<State> Pool = new System.Collections.Generic.Stack<State>();
|
|
public override void Despawn() { Pool.Push(this); }\r\n\t\t}\r\n\r\n\t\tpublic
|
|
State Data;\r\n\t}\r\n}\r\n\r\nnamespace Lean.Transition\r\n{\r\n\tpublic static
|
|
partial class LeanExtensions\r\n\t{\r\n\t\tpublic static TARGET {PROPERTY}Transition_{ELEMENT}(this
|
|
TARGET target, float value, float duration, LeanEase ease = LeanEase.Smooth)\r\n\t\t{\r\n\t\t\tMethod.Lean{TITLE}.Register(target,
|
|
value, duration, ease); return target;\r\n\t\t}\r\n\t}\r\n}"
|