C# Class GameEngine.Drawing.Bitmap.Animation

Animation class that allows the user to specify metrics about animation frames from a spritesheet. Also allows specification of other meta properties such as the Delay between frames, whether the animation should loop and what methods to provide information about current frame information based on the Game Time.
Inheritance: BitmapDrawable
Afficher le fichier Open project: MichaelAquilina/Some-2D-RPG

Méthodes publiques

Méthode Description
Animation ( Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, Rectangle frames, int frameDelay = FRAME_DELAY_DEFAULT, bool loop = false ) : System

Initialises an Animation object specifies a SpriteSheet to us and the individual frame locations within the sheet the use. Optionally, the Delay between Frame changes and whether the animation should loop when complete can be passed as constructor parameters.

GetFrame ( double elapsedMS ) : Rectangle

Returns the Current Frame to show in the sprite sheet based on the current games running time.

GetFrameIndex ( double elapsedMS ) : int

Returns the current Frame Index as an integer value based on the GameTime parameters passed into this method.

GetSourceRectangle ( double elapsedMS ) : Rectangle?
GetSourceTexture ( double elapsedMS ) : Microsoft.Xna.Framework.Graphics.Texture2D
IsFinished ( double elapsedMS ) : bool

Specifies whether the Animation has completed. If the Animation is of Looping type, then this method will always return a true. For non-looping animations, this method should return a true once it has passed its last frame. The GameTime parameter is required to determine its current position based on the current GameTime.

ToString ( ) : string

Method Details

Animation() public méthode

Initialises an Animation object specifies a SpriteSheet to us and the individual frame locations within the sheet the use. Optionally, the Delay between Frame changes and whether the animation should loop when complete can be passed as constructor parameters.
public Animation ( Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, Rectangle frames, int frameDelay = FRAME_DELAY_DEFAULT, bool loop = false ) : System
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D Texture2D object that represents the SpriteSheet to use for this animation.
frames Microsoft.Xna.Framework.Rectangle Array of Rectangle objects that specify the locations in the spritesheet to use as frames.
frameDelay int
loop bool bool value specifying wheter the animation should re-start at the end of the animation frames. Defaults to false.
Résultat System

GetFrame() public méthode

Returns the Current Frame to show in the sprite sheet based on the current games running time.
public GetFrame ( double elapsedMS ) : Rectangle
elapsedMS double
Résultat Microsoft.Xna.Framework.Rectangle

GetFrameIndex() public méthode

Returns the current Frame Index as an integer value based on the GameTime parameters passed into this method.
public GetFrameIndex ( double elapsedMS ) : int
elapsedMS double
Résultat int

GetSourceRectangle() public méthode

public GetSourceRectangle ( double elapsedMS ) : Rectangle?
elapsedMS double
Résultat Rectangle?

GetSourceTexture() public méthode

public GetSourceTexture ( double elapsedMS ) : Microsoft.Xna.Framework.Graphics.Texture2D
elapsedMS double
Résultat Microsoft.Xna.Framework.Graphics.Texture2D

IsFinished() public méthode

Specifies whether the Animation has completed. If the Animation is of Looping type, then this method will always return a true. For non-looping animations, this method should return a true once it has passed its last frame. The GameTime parameter is required to determine its current position based on the current GameTime.
public IsFinished ( double elapsedMS ) : bool
elapsedMS double
Résultat bool

ToString() public méthode

public ToString ( ) : string
Résultat string