C# Класс MonoGameFoundation.Animation

Animates a series of frames on a specified row of a sprite sheet.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Animation ( Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int spriteSheetRow, int framePixelWidth, int framePixelHeight, int framesLength, int frameDuration, bool flipHorizontally = false ) : System

Creates a new Animation instance.

Draw ( SpriteBatch spriteBatch, Vector2 position, float scale ) : void

Draw the current frame.

Reset ( ) : void

Resets the animation to the initial frame.

Update ( GameTime gameTime ) : void

Updates the current frame of the animation.

Описание методов

Animation() публичный Метод

Creates a new Animation instance.
public Animation ( Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int spriteSheetRow, int framePixelWidth, int framePixelHeight, int framesLength, int frameDuration, bool flipHorizontally = false ) : System
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D The source sprite sheet containing the row of frames to animate.
spriteSheetRow int The row in the sprite sheet containing the frames to animate.
framePixelWidth int The width in pixels of each frame in the row.
framePixelHeight int The height in pixel of each frame in the row.
framesLength int The number of frames in the row.
frameDuration int The time, in milliseconds, to display each frame.
flipHorizontally bool A flag specifying whether to flip the animation horizontally (e.g., to turn an animation facing the right into a left-facing animation).
Результат System

Draw() публичный Метод

Draw the current frame.
public Draw ( SpriteBatch spriteBatch, Vector2 position, float scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch in which to draw.
position Vector2 The position at which to draw.
scale float The scale at which to draw.
Результат void

Reset() публичный Метод

Resets the animation to the initial frame.
public Reset ( ) : void
Результат void

Update() публичный Метод

Updates the current frame of the animation.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void