C# 클래스 ThreadedPlatformer.Level

A uniform grid of tiles with collections of gems and enemies. The level owns the player and controls the game's win and lose conditions as well as scoring.
상속: IDisposable
파일 보기 프로젝트 열기: sq/Fracture 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void

Unloads the level content.

Draw ( GameTime gameTime, Frame frame, DefaultMaterialSet materials ) : void

Draw everything in the level from background to foreground.

GetBounds ( int x, int y ) : Rectangle

Gets the bounding rectangle of a tile in world space.

GetCollision ( int x, int y ) : TileCollision

Gets the collision mode of the tile at a particular location. This method handles tiles outside of the levels boundries by making it impossible to escape past the left or right edges, but allowing things to jump beyond the top of the level and fall off the bottom.

Level ( IServiceProvider serviceProvider, string path ) : System

Constructs a new level.

StartNewLife ( ) : void

Restores the player to the starting point to try the level again.

Update ( GameTime gameTime ) : void

Updates all objects in the world, performs collision between them, and handles the time limit with scoring.

비공개 메소드들

메소드 설명
DrawTiles ( BitmapBatch batch ) : void

Draws each tile in the level.

LoadEnemyTile ( int x, int y, string spriteSet ) : Tile

Instantiates an enemy and puts him in the level.

LoadExitTile ( int x, int y ) : Tile

Remembers the location of the level's exit.

LoadGemTile ( int x, int y ) : Tile

Instantiates a gem and puts it in the level.

LoadStartTile ( int x, int y ) : Tile

Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected.

LoadTile ( char tileType, int x, int y ) : Tile

Loads an individual tile's appearance and behavior.

LoadTile ( string name, TileCollision collision ) : Tile

Creates a new tile. The other tile loading methods typically chain to this method after performing their special logic.

LoadTiles ( string path ) : void

Iterates over every tile in the structure file and loads its appearance and behavior. This method also validates that the file is well-formed with a player start point, exit, etc.

LoadVarietyTile ( string baseName, int variationCount, TileCollision collision ) : Tile

Loads a tile with a random appearance.

OnExitReached ( ) : void

Called when the player reaches the level's exit.

OnGemCollected ( Gem gem, Player collectedBy ) : void

Called when a gem is collected.

OnPlayerKilled ( Enemy killedBy ) : void

Called when the player is killed.

UpdateEnemies ( GameTime gameTime ) : void

Animates each enemy and allow them to kill the player.

UpdateGems ( GameTime gameTime ) : void

Animates each gem and checks to allows the player to collect them.

메소드 상세

Dispose() 공개 메소드

Unloads the level content.
public Dispose ( ) : void
리턴 void

Draw() 공개 메소드

Draw everything in the level from background to foreground.
public Draw ( GameTime gameTime, Frame frame, DefaultMaterialSet materials ) : void
gameTime Microsoft.Xna.Framework.GameTime
frame Frame
materials DefaultMaterialSet
리턴 void

GetBounds() 공개 메소드

Gets the bounding rectangle of a tile in world space.
public GetBounds ( int x, int y ) : Rectangle
x int
y int
리턴 Microsoft.Xna.Framework.Rectangle

GetCollision() 공개 메소드

Gets the collision mode of the tile at a particular location. This method handles tiles outside of the levels boundries by making it impossible to escape past the left or right edges, but allowing things to jump beyond the top of the level and fall off the bottom.
public GetCollision ( int x, int y ) : TileCollision
x int
y int
리턴 TileCollision

Level() 공개 메소드

Constructs a new level.
public Level ( IServiceProvider serviceProvider, string path ) : System
serviceProvider IServiceProvider /// The service provider that will be used to construct a ContentManager. ///
path string /// The absolute path to the level file to be loaded. ///
리턴 System

StartNewLife() 공개 메소드

Restores the player to the starting point to try the level again.
public StartNewLife ( ) : void
리턴 void

Update() 공개 메소드

Updates all objects in the world, performs collision between them, and handles the time limit with scoring.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
리턴 void