/// <summary> /// Disposes of the tween and resets all variables. /// </summary> public void Dispose() { if (m_TweenData != null) { if (m_State == State.Run && m_Cancel != CancelMode.Nothing) { m_Reversed = false; float curvedPercent = 0; switch (m_Cancel) { case CancelMode.Revert: curvedPercent = Evaluate(0); break; case CancelMode.RevertNoWave: curvedPercent = EvaluateNoWave(0); break; case CancelMode.ForceEnd: curvedPercent = Evaluate(m_Mode == LoopMode.Yoyo || m_Mode == LoopMode.YoyoLoop ? 0 : 1); break; case CancelMode.ForceEndNoWave: curvedPercent = EvaluateNoWave(m_Mode == LoopMode.Yoyo || m_Mode == LoopMode.YoyoLoop ? 0 : 1); break; } m_TweenData.ApplyTween(curvedPercent); if (m_OnUpdate != null) { m_OnUpdate(m_FromMode ? 1 - curvedPercent : curvedPercent); } } m_TweenData.OnTweenEnd(); m_TweenData = null; TweenPool.Free(this); } m_Cancel = CancelMode.Nothing; m_Mode = LoopMode.Single; m_Curve = Curve.Linear; m_AnimCurve = null; m_WaveFunc = default(Wave); m_NumLoops = 0; m_OnStart = null; m_OnUpdate = null; m_OnComplete = null; m_Reversed = false; m_MirrorCurve = false; m_FromMode = false; m_Instant = false; m_StartMode = StartMode.Restart; m_StartTime = 0; m_CurrentPercent = 0; m_PercentIncrement = 0; m_State = State.Begin; }
private Tween SetData(ITweenData inData) { m_TweenData = inData; return(this); }
/// <summary> /// Creates a tween with the given tween parameters. /// </summary> static public Tween Create(ITweenData inTweenData, TweenSettings inSettings) { return(TweenPool.Alloc().SetData(inTweenData).Duration(inSettings.Time).Ease(inSettings.Curve)); }
/// <summary> /// Creates a tween with the given tween parameters. /// </summary> static public Tween Create(ITweenData inTweenData, float inDuration) { return(TweenPool.Alloc().SetData(inTweenData).Duration(inDuration)); }
/// <summary> /// Creates a tween with the given tween parameters. /// </summary> static public Tween Create(ITweenData inTweenData, float inDuration) { return(new Tween().SetData(inTweenData).Duration(inDuration)); }