private void GoBack() { switch (this.m_dir) { case ENUM_ITEM_DIRECTION.E_LEFT: { CustomTweenRotation.Begin(this.gameObject, 0.5f, C_LEFT_ANG); } break; case ENUM_ITEM_DIRECTION.E_DOWN: { CustomTweenRotation.Begin(this.gameObject, 0.5f, C_DOWN_ANG); } break; case ENUM_ITEM_DIRECTION.E_RIGHT: { CustomTweenRotation.Begin(this.gameObject, 0.5f, C_RIGHT_ANG); } break; case ENUM_ITEM_DIRECTION.E_UP: { CustomTweenRotation.Begin(this.gameObject, 0.5f, C_UP_ANG); } break; } }
void OnDisable() { if (mStarted && tweenTarget != null) { CustomTweenRotation tc = tweenTarget.GetComponent <CustomTweenRotation>(); if (tc != null) { tc.value = mRot; tc.enabled = false; } } }
/// <summary> /// 开始补间操作 /// </summary> static public CustomTweenRotation Begin(GameObject go, float duration, Quaternion rot) { CustomTweenRotation comp = CustomUITweener.Begin <CustomTweenRotation>(go, duration); comp.from = comp.value.eulerAngles; comp.to = rot.eulerAngles; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
static public CustomTweenRotation Begin(GameObject go, float duration, Quaternion rot) { //todo:// CustomTweenRotation comp = go.GetOrAddComponent <CustomTweenRotation>(); return(comp); /* UITweenerBase.Begin<CustomTweenRotation>(go, duration); * comp.From = comp.value.eulerAngles; * comp.to = rot.eulerAngles; * * if (duration <= 0f) * { * comp.Sample(1f, true); * comp.enabled = false; * } * return comp;* /*/ }
public override void OnInspectorGUI() { GUILayout.Space(6f); CustomUITweenEditorTools.SetLabelWidth(120f); CustomTweenRotation tw = target as CustomTweenRotation; 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 Rotation(Quaternion to) { CustomTweenRotation.Begin(tweenTarget.gameObject, duration, to).easeType = EaseType.linear; }