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