C# Класс Bricklayer.Client.World.Map

Наследование: Bricklayer.Common.World.Map
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
tileSheet Microsoft.Xna.Framework.Graphics.Texture2D

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

Метод Описание
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)

Приватные методы

Метод Описание
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

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

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

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
Результат bool

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

Creates a camera object at a set size
public CreateCamera ( ) : void
Результат void

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

Draws the map blocks an entities
public Draw ( SpriteBatch spriteBatch, GameTime gameTime ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
gameTime Microsoft.Xna.Framework.GameTime
Результат void

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 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
Результат BlockCollision

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

Gets the bounding rectangle of a tile in world space.
public GetTileBounds ( int x, int y ) : Rectangle
x int
y int
Результат Microsoft.Xna.Framework.Rectangle

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

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
Результат System

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

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
Результат void

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

Sets block's default colors from their image for use with the minimap
public SetMinimapColors ( ) : void
Результат void

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

Updates the map's entities and handles input
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

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

Handles logic for updating tiles (Ex: animation)
public UpdateTiles ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

Описание свойств

tileSheet публичное свойство

public Texture2D,Microsoft.Xna.Framework.Graphics tileSheet
Результат Microsoft.Xna.Framework.Graphics.Texture2D