C# Класс Platformer.Levels.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
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Dispose ( ) : void
DrawBehind ( GameTime gameTime, SpriteBatch spriteBatch ) : void

Draw everything in the level from background to foreground.

DrawInFront ( GameTime gameTime, SpriteBatch spriteBatch ) : void
GetBounds ( int x, int y ) : RectangleF

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.

GetTileCollisionBehindPlayer ( Vector2 playerPosition ) : TileCollision
GetTileCollisionBelowPlayer ( Vector2 playerPosition ) : TileCollision
Level ( String name, int width, int height, Microsoft.Xna.Framework.Content.ContentManager content ) : System
LoadContent ( ) : void
Update ( Player player, GameTime gameTime, KeyboardState keyboardState, InputManager inputManager ) : void

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

UpdateSpawn ( Spawner spawner ) : void

Called by a Spawner when it has been activated.

activate ( string active ) : void

Activates a particular activatable.

addActivatable ( string tileID, IActivatable active ) : void

Adds and activatable item to the activatables list.

addActivator ( string tileID, Tiles actor ) : void

Adds an activator into the activators list.

addBind ( string actorName, string activeName ) : void

Binds and activator to a particular activatable.

addMoveable ( string tileID, MoveableTile mTile ) : void

Adds a moveable tile to the level. If the ID of the tile already exists then the tile is linked to the exiting tile as its leader.

addTile ( int x, int y ) : void

Adds an empty passable tile into the tile array.

addTile ( int x, int y, Tile newTile ) : void

Adds a tile into the tile array.

getGridPosition ( float x, float y ) : Vector2
getTile ( int x, int y ) : Tile
isTileInBounds ( int x, int y ) : bool

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

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

public Dispose ( ) : void
Результат void

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

Draw everything in the level from background to foreground.
public DrawBehind ( GameTime gameTime, SpriteBatch spriteBatch ) : void
gameTime Microsoft.Xna.Framework.GameTime
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
Результат void

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

public DrawInFront ( GameTime gameTime, SpriteBatch spriteBatch ) : void
gameTime Microsoft.Xna.Framework.GameTime
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
Результат void

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

Gets the bounding rectangle of a tile in world space.
public GetBounds ( int x, int y ) : RectangleF
x int
y int
Результат RectangleF

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

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

public GetTileCollisionBehindPlayer ( Vector2 playerPosition ) : TileCollision
playerPosition Vector2
Результат TileCollision

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

public GetTileCollisionBelowPlayer ( Vector2 playerPosition ) : TileCollision
playerPosition Vector2
Результат TileCollision

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

public Level ( String name, int width, int height, Microsoft.Xna.Framework.Content.ContentManager content ) : System
name String
width int
height int
content Microsoft.Xna.Framework.Content.ContentManager
Результат System

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

public LoadContent ( ) : void
Результат void

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

Updates all objects in the world, performs collision between them, and handles the time limit with scoring.
public Update ( Player player, GameTime gameTime, KeyboardState keyboardState, InputManager inputManager ) : void
player Player
gameTime Microsoft.Xna.Framework.GameTime
keyboardState Microsoft.Xna.Framework.Input.KeyboardState
inputManager InputManager
Результат void

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

Called by a Spawner when it has been activated.
public UpdateSpawn ( Spawner spawner ) : void
spawner Platformer.Tiles.Spawner The spawner to set as the active spawn point.
Результат void

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

Activates a particular activatable.
public activate ( string active ) : void
active string The ID of the activatable.
Результат void

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

Adds and activatable item to the activatables list.
public addActivatable ( string tileID, IActivatable active ) : void
tileID string The ID of the tilwe.
active IActivatable The activatable instance.
Результат void

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

Adds an activator into the activators list.
public addActivator ( string tileID, Tiles actor ) : void
tileID string The ID of the tile.
actor Tiles The activator instance.
Результат void

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

Binds and activator to a particular activatable.
public addBind ( string actorName, string activeName ) : void
actorName string The activator which will trigger.
activeName string The activatable which will be activated.
Результат void

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

Adds a moveable tile to the level. If the ID of the tile already exists then the tile is linked to the exiting tile as its leader.
public addMoveable ( string tileID, MoveableTile mTile ) : void
tileID string The ID of the tile.
mTile Platformer.Tiles.MoveableTile The moveable tile instance.
Результат void

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

Adds an empty passable tile into the tile array.
public addTile ( int x, int y ) : void
x int
y int
Результат void

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

Adds a tile into the tile array.
public addTile ( int x, int y, Tile newTile ) : void
x int
y int
newTile Platformer.Tiles.Tile
Результат void

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

public getGridPosition ( float x, float y ) : Vector2
x float
y float
Результат Vector2

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

public getTile ( int x, int y ) : Tile
x int
y int
Результат Platformer.Tiles.Tile

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

public isTileInBounds ( int x, int y ) : bool
x int
y int
Результат bool