void OnDisable() { if (mStarted && tweenTarget != null) { CustomTweenPosition tc = tweenTarget.GetComponent <CustomTweenPosition>(); if (tc != null) { tc.value = mPos; tc.enabled = false; } } }
/// <summary> /// 开始补间操作 /// </summary> static public CustomTweenPosition Begin(GameObject go, float duration, Vector3 pos) { CustomTweenPosition comp = CustomUITweener.Begin <CustomTweenPosition>(go, duration); comp.from = comp.value; comp.to = pos; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
public override void OnInspectorGUI() { GUILayout.Space(6f); CustomUITweenEditorTools.SetLabelWidth(120f); CustomTweenPosition tw = target as CustomTweenPosition; GUI.changed = false; Vector3 from = EditorGUILayout.Vector3Field("From", tw.from); Vector3 to = EditorGUILayout.Vector3Field("To", tw.to); if (GUI.changed) { CustomUITweenEditorTools.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; CustomUITweenTools.SetDirty(tw); } DrawCommonProperties(); }
void Offset(Vector3 to) { CustomTweenPosition.Begin(tweenTarget.gameObject, duration, to).easeType = EaseType.linear; }