Platformer.AnimationPlayer.PlayAnimation C# (CSharp) Method

PlayAnimation() public method

Begins or continues playback of an animation.
public PlayAnimation ( Animation animation ) : void
animation Animation
return void
        public void PlayAnimation(Animation animation)
        {
            paused = false;

            // If this animation is already running, do not restart it.
            if (Animation == animation)
                return;

            // Start the new animation.
            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
            this.done = false;
        }

Usage Example

示例#1
0
 /// <summary>
 /// Resets the player to life.
 /// </summary>
 /// <param name="position">The position to come to life at.</param>
 public void Reset(Vector2 position)
 {
     Position = position;
     Velocity = Vector2.Zero;
     isAlive  = true;
     sprite.PlayAnimation(idleAnimation);
     player_move_type = enum_move_type.move_type_idle;
 }
All Usage Examples Of Platformer.AnimationPlayer::PlayAnimation