public void Update(int millisecs) { if (AnimationType == SpriteAnimationType.SingleFrame) { if (Completed == false) { Completed = true; } return; } //update frame rate timer FrameRateTimer.Update(millisecs); if (FrameRateTimer.Completed) { //are we at end of animation strip if (FrameCellIndex == (FrameCount - 1)) { //act according to the animation type if (AnimationType == SpriteAnimationType.NonLooping_ResetBackToStartingFrame) { //no reset of timer as this is where animation stops FrameCellIndex = 0; Completed = true; } else if (AnimationType == SpriteAnimationType.NonLooping_PauseOnEndFrame) { Completed = true; } else if (AnimationType == SpriteAnimationType.LoopingAnimation) { //reset back to cell zero and continue FrameCellIndex = 0; FrameRateTimer.Reset(); } } else { //keep going FrameCellIndex += 1; FrameRateTimer.Reset(); } } }
public void Reset() { FrameCellIndex = 0; Completed = false; FrameRateTimer.Reset(); }