//--------------------------------------------------------------------------- public void Reset() { m_Time = 0.0f; if (IsReversed) { m_Frame = EndFrame; m_Direction = EPlayDirection.Backward; } else { m_Frame = StartFrame; m_Direction = EPlayDirection.Forward; } }
//--------------------------------------------------------------------------- public bool Tick(float deltaTime) { float duration = (1.0f / FPS); float maxDuration = duration * (EndFrame - StartFrame); m_Time += deltaTime; switch (m_Direction) { case EPlayDirection.Forward: m_Frame = StartFrame + (int)(m_Time / duration); if (IsBounced && m_Frame == EndFrame) { m_Direction = EPlayDirection.Backward; } break; case EPlayDirection.Backward: m_Frame = EndFrame - (int)(m_Time / duration); if (IsBounced && m_Frame == StartFrame) { m_Direction = EPlayDirection.Forward; } break; } if (m_Time > maxDuration) { m_Time -= maxDuration; if (!Loop) { return(false); } } return(true); }