C# Class Bricklayer.Client.World.Map

Inheritance: Bricklayer.Common.World.Map
显示文件 Open project: Cyral/Bricklayer Class Usage Examples

Public Properties

Property Type Description
tileSheet Microsoft.Xna.Framework.Graphics.Texture2D

Public Methods

Method Description
CanPlaceBlock ( int x, int y, int z, BlockType block ) : bool

Determines if a player can place a block at a specified position

CreateCamera ( ) : void

Creates a camera object at a set size

Draw ( SpriteBatch spriteBatch, GameTime gameTime ) : void

Draws the map blocks an entities

GetCollision ( int x, int y ) : BlockCollision

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 MainCamera.btnLeft or MainCamera.btnRight edges, but allowing things to jump beyond the MainCamera.Top of the level and fall off the MainCamera.bottom.

GetTileBounds ( int x, int y ) : Rectangle

Gets the bounding rectangle of a tile in world space.

Map ( Microsoft.Xna.Framework.Game game, int width, int height ) : System

Creates a client-side version of a map at the specified width and height (To be changed later once Init packet recieved)

PlaceTile ( int x, int y, Layer layer, BlockType block, bool sendMessage ) : void

Places a tile at the specified position, WHILE taking into account it's TileType Mainly used for player block placement, if you are looking to place a block through the code Either use `Tiles[x,y,z] =` or, set sendMessage to false

SetMinimapColors ( ) : void

Sets block's default colors from their image for use with the minimap

Update ( GameTime gameTime ) : void

Updates the map's entities and handles input

UpdateTiles ( GameTime gameTime ) : void

Handles logic for updating tiles (Ex: animation)

Private Methods

Method Description
DrawTiles ( SpriteBatch spriteBatch ) : void

Draws the foreground and background blocks of a map

HandleInput ( ) : void

Handles input for the level, such as clicking blocks and selecting them

LoadContent ( ) : void

Loads content needed for drawing on the client

Method Details

CanPlaceBlock() public method

Determines if a player can place a block at a specified position
public CanPlaceBlock ( int x, int y, int z, BlockType block ) : bool
x int
y int
z int
block BlockType
return bool

CreateCamera() public method

Creates a camera object at a set size
public CreateCamera ( ) : void
return void

Draw() public method

Draws the map blocks an entities
public Draw ( SpriteBatch spriteBatch, GameTime gameTime ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
gameTime Microsoft.Xna.Framework.GameTime
return void

GetCollision() public method

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 MainCamera.btnLeft or MainCamera.btnRight edges, but allowing things to jump beyond the MainCamera.Top of the level and fall off the MainCamera.bottom.
public GetCollision ( int x, int y ) : BlockCollision
x int
y int
return BlockCollision

GetTileBounds() public method

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

Map() public method

Creates a client-side version of a map at the specified width and height (To be changed later once Init packet recieved)
public Map ( Microsoft.Xna.Framework.Game game, int width, int height ) : System
game Microsoft.Xna.Framework.Game
width int
height int
return System

PlaceTile() public method

Places a tile at the specified position, WHILE taking into account it's TileType Mainly used for player block placement, if you are looking to place a block through the code Either use `Tiles[x,y,z] =` or, set sendMessage to false
public PlaceTile ( int x, int y, Layer layer, BlockType block, bool sendMessage ) : void
x int The X position on the grid
y int The Y position on the grid
layer Layer The layer, either background or foreground
block BlockType The block to place
sendMessage bool Should the block be sent to the server or not
return void

SetMinimapColors() public method

Sets block's default colors from their image for use with the minimap
public SetMinimapColors ( ) : void
return void

Update() public method

Updates the map's entities and handles input
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

UpdateTiles() public method

Handles logic for updating tiles (Ex: animation)
public UpdateTiles ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

Property Details

tileSheet public_oe property

public Texture2D,Microsoft.Xna.Framework.Graphics tileSheet
return Microsoft.Xna.Framework.Graphics.Texture2D