protected AnimatedSprite(AnimatedSprite other) : base(other) { m_AnimationSpeed = other.m_AnimationSpeed; m_AnimationStopped = other.m_AnimationStopped; m_BackAndForthDirection = other.m_BackAndForthDirection; m_CurrentFrame = other.m_CurrentFrame; m_FrameCount = other.m_FrameCount; m_FrameWidth = other.m_FrameWidth; m_LoopType = other.m_LoopType; m_UpdateTimeSum = other.m_UpdateTimeSum; ResetLoop(); }
public void PrevFrame(AnimatedSpriteLoopType loopType) { switch (loopType) { case AnimatedSpriteLoopType.None: { m_CurrentFrame--; if (m_CurrentFrame < 0) { m_CurrentFrame = 0; m_AnimationStopped = true; } break; } case AnimatedSpriteLoopType.LoopAround: { m_CurrentFrame--; if (m_CurrentFrame < 0) m_CurrentFrame = m_FrameCount-1; break; } case AnimatedSpriteLoopType.LoopAroundReversed: { m_CurrentFrame++; if (m_CurrentFrame == m_FrameCount) m_CurrentFrame = 0; break; } case AnimatedSpriteLoopType.LoopBackAndForth: { m_CurrentFrame -= m_BackAndForthDirection; if (m_CurrentFrame == m_FrameCount) { m_BackAndForthDirection = -1; m_CurrentFrame -= 2; } else if (m_CurrentFrame == -1) { m_BackAndForthDirection = 1; m_CurrentFrame = 1; } break; } } }