예제 #1
0
파일: Tween.cs 프로젝트: vthem/LectureFlash
        /// <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;
        }
예제 #2
0
파일: Tween.cs 프로젝트: vthem/LectureFlash
 private Tween SetData(ITweenData inData)
 {
     m_TweenData = inData;
     return(this);
 }
예제 #3
0
파일: Tween.cs 프로젝트: vthem/LectureFlash
 /// <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));
 }
예제 #4
0
파일: Tween.cs 프로젝트: vthem/LectureFlash
 /// <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));
 }
예제 #5
0
 /// <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));
 }