/// <summary> /// Main constructor /// </summary> /// <remarks>Using this should be the norm for an animator</remarks> /// <param name="anim">The animation to play</param> public Animator(Animation anim) { //Set up the rectangle mFrameRect = new Rectangle(0, 0, anim.FrameWidth, anim.FrameHeight); Animation = anim; }
/// <summary> /// Plays a certain animation /// </summary> /// <param name="anim">The animation to play</param> /// <param name="effects">The sprite effect to use</param> public void Play(Animation anim,SpriteEffects effects) { if (Animation.Name == anim.Name) { //Don't do anything return; } //Reset the current animation mEffects = effects; Animation = anim; mFrameRect.X = 0; mElaspedTime = 0; mCurrentFrame = 0; }