C# Class Platformer.Levels.LevelFactory

Show file Open project: zmthy/play-dead Class Usage Examples

Public Methods

Method Description
CreateLevel ( String name, String filepath, String theme ) : Level

Factory Method for level creation. Creates a new content manager for loading a particular theme and loads the level from the provided file.

CreateWaterDrain ( string name ) : WaterDrain
LevelFactory ( IServiceProvider services, DynamicMap dynamicMap, GraphicsDevice gd ) : System

Private Methods

Method Description
BindLevel ( List levelBinds, Level level ) : void

Adds bindings to the activators for their activatables.

BuildLevel ( List levelRows, Level level ) : void

Builds the level based on the tile layout. This method setups the basic tile grid, along with creating activators, activatables and moving tiles.

CreateActivatable ( char tileType, int x, int y ) : Platformer.Tiles.IActivatable

Creates the different kinds of activatables.

CreateActivator ( char tileType, int x, int y ) : Activator

Creates the different kinds of activators.

CreateButton ( int x, int y ) : Activator
CreateDoorTile ( int x, int y, bool p, TileCollision tileCollision ) : MoveableTile
CreateExit ( int x, int y ) : Activator
CreateLadder ( int x, int y ) : IActivatable
CreateLaser ( int x, int y ) : Activator
CreateLight ( int x, int y ) : IActivatable
CreateMirror ( int x, int y ) : Activator
CreateMoveable ( char tileType, int x, int y ) : MoveableTile

Creates the different kinds of moveable tiles.

CreateSlidingTile ( int x, int y, bool isHorizontal, TileCollision collision ) : MoveableTile
CreateSpawner ( int x, int y ) : IActivatable

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

CreateSwitch ( int x, int y ) : Activator
CreateTile ( char tileType, int x, int y ) : Tile

Loads an individual tile's appearance and behavior.

CreateTile ( string name, TileCollision collision ) : Tile

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

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

Loads a tile with a random appearance.

CreateWaterSource ( string name ) : WaterSource
CreateWheel ( int x, int y ) : Activator
ParseBindings ( StreamReader reader ) : List

Reads in all the bindings for the level.

ParseLevel ( StreamReader reader ) : List

Reads in all the lines related to the tile layout from the level file.

Method Details

CreateLevel() public method

Factory Method for level creation. Creates a new content manager for loading a particular theme and loads the level from the provided file.
public CreateLevel ( String name, String filepath, String theme ) : Level
name String
filepath String
theme String
return Level

CreateWaterDrain() public method

public CreateWaterDrain ( string name ) : WaterDrain
name string
return Platformer.Tiles.WaterDrain

LevelFactory() public method

public LevelFactory ( IServiceProvider services, DynamicMap dynamicMap, GraphicsDevice gd ) : System
services IServiceProvider
dynamicMap DynamicMap
gd GraphicsDevice
return System