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.
파일 보기 프로젝트 열기: Bacon41/PantheonPrototype

보호된 프로퍼티들

프로퍼티 타입 설명
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