C# Класс PantheonPrototype.Sprite

Provides a basic class for managing a sprite on screen. This class contains a loading method, a potential state system, and a drawing method.
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
rotation float

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

Метод Описание
Draw ( SpriteBatch canvas, Rectangle location, Vector2 origin ) : void

Draws the sprite to the screen at the given location.

Sprite ( ) : System
Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns ) : System
Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, bool backAndForth ) : System
Update ( GameTime gameTime ) : void
addState ( string state, int first, int last, bool looping, bool sweeping ) : void

Creates a new state and adds it to the sprite. Deletes the default state the first time this is called. If the current state is the default state, the method shall check to see if the current frame is outside of the new range and shall adjust so that it is not.

changeState ( string state ) : bool

Changes the current animation state of the sprite.

getState ( ) : string

This method returns the name of the curren state.

isComplete ( ) : bool
loadSprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, bool sweeping ) : void

Loads a sprite with an image. Note: This function will clear any classes

loadSprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, int frameRate ) : void

Alternative wrapper for backwards compatibility

removeState ( string state ) : void

Removes the specified state from the sprite.

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

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

Draws the sprite to the screen at the given location.
public Draw ( SpriteBatch canvas, Rectangle location, Vector2 origin ) : void
canvas Microsoft.Xna.Framework.Graphics.SpriteBatch An initialized SpriteBatch to which the sprite will be drawn.
location Microsoft.Xna.Framework.Rectangle The location as a vector to which the sprite should be drawn.
origin Vector2 The origin around which the sprite should rotate
Результат void

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

public Sprite ( ) : System
Результат System

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

public Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns ) : System
image Microsoft.Xna.Framework.Graphics.Texture2D
rows int
columns int
Результат System

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

public Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, bool backAndForth ) : System
image Microsoft.Xna.Framework.Graphics.Texture2D
rows int
columns int
backAndForth bool
Результат System

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

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

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

Creates a new state and adds it to the sprite. Deletes the default state the first time this is called. If the current state is the default state, the method shall check to see if the current frame is outside of the new range and shall adjust so that it is not.
public addState ( string state, int first, int last, bool looping, bool sweeping ) : void
state string The name for the new state.
first int The first frame of the new state.
last int The last frame of the new state.
looping bool Whether or not the animation of the current state should loop.
sweeping bool Whether or not the animation of the current state plays back and forth.
Результат void

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

Changes the current animation state of the sprite.
public changeState ( string state ) : bool
state string The new state for the sprite.
Результат bool

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

This method returns the name of the curren state.
public getState ( ) : string
Результат string

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

public isComplete ( ) : bool
Результат bool

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

Loads a sprite with an image. Note: This function will clear any classes
public loadSprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, bool sweeping ) : void
image Microsoft.Xna.Framework.Graphics.Texture2D The image to be used for the sprite.
rows int The number of frame rows in the image.
columns int The number of frame columns in the image.
sweeping bool
Результат void

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

Alternative wrapper for backwards compatibility
public loadSprite ( Microsoft.Xna.Framework.Graphics.Texture2D image, int rows, int columns, int frameRate ) : void
image Microsoft.Xna.Framework.Graphics.Texture2D The image to be used for the sprite.
rows int The number of frame rows in the image.
columns int The number of frame columns in the image.
frameRate int The frame rate at which the sprite updates.
Результат void

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

Removes the specified state from the sprite.
public removeState ( string state ) : void
state string The name of the state to remove.
Результат void

Описание свойств

rotation защищенное свойство

protected float rotation
Результат float