public void PlayAnimation(Animation animation) { if (CurrentAnimation == animation) return; CurrentAnimation = animation; FrameIndex = 0; _time = 0.0f; }
public static Animation CompileAnimation(Texture2D texture, int yIndex, int numFrames, Vector2 frameSize, float frameTime, bool isLooping) { var animation = new Animation(texture, frameTime, isLooping); for (var i = 0; i < numFrames; i++) { animation.FrameList.Add((new Rectangle((int)(i * frameSize.X), (int)(yIndex * frameSize.X), (int)frameSize.X, (int)frameSize.Y))); } return animation; }