44 lines
3.2 KiB
Plaintext
44 lines
3.2 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: Vector2
|
|
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}
|
|
value.</summary>\r\n\t[UnityEngine.HelpURL(LeanTransition.HelpUrlPrefix + \"Lean{TITLE}\")]\r\n\t[UnityEngine.AddComponentMenu(LeanTransition.MethodsMenuPrefix
|
|
+ \"{COMPONENT}/{COMPONENT}.{PROPERTY}\" + 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, UnityEngine.Vector2 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
|
|
UnityEngine.Vector2 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 UnityEngine.Vector2
|
|
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} != 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};\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};\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\tTarget.{PROPERTY}
|
|
= UnityEngine.Vector2.LerpUnclamped(oldValue, Value, Smooth(Ease, progress));\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(this
|
|
TARGET target, UnityEngine.Vector2 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}"
|