C# Класс TiledLib.Map

A full map from Tiled.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
CheckCollision ( Vector2 position ) : bool?
CheckTileCollision ( Vector2 position ) : bool
CheckTileCollisionIntersect ( Vector2 position, Rectangle rect ) : Rectangle?
Draw ( SpriteBatch spriteBatch, Camera gameCamera ) : void

Draws all layers of the map

DrawAsMap ( SpriteBatch spriteBatch, int scale ) : void

Draws all layers of the map

DrawLayer ( SpriteBatch spriteBatch, TiledLib.Layer layer, Camera gameCamera, Vector2 offset, float alpha, Color color ) : void

Draws a single layer of the map

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera ) : void

Draws a single layer by layer name

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Color color ) : void

Draws a single layer by layer name, with a specified color

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Vector2 shadowOffset, float alpha ) : void

Draws a single layer as shadows, by layer name

GetLayer ( string name ) : TiledLib.Layer

Gets a layer by name.

Map ( Microsoft.Xna.Framework.Content.ContentManager content, string mapName ) : System
UnloadContent ( ) : void

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

Метод Описание
Map ( Microsoft.Xna.Framework.Content.ContentReader reader ) : System

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

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

public CheckCollision ( Vector2 position ) : bool?
position Vector2
Результат bool?

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

public CheckTileCollision ( Vector2 position ) : bool
position Vector2
Результат bool

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

public CheckTileCollisionIntersect ( Vector2 position, Rectangle rect ) : Rectangle?
position Vector2
rect Microsoft.Xna.Framework.Rectangle
Результат Rectangle?

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

Draws all layers of the map
public Draw ( SpriteBatch spriteBatch, Camera gameCamera ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the map.
gameCamera Camera The camera to use for positioning.
Результат void

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

Draws all layers of the map
public DrawAsMap ( SpriteBatch spriteBatch, int scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the map.
scale int
Результат void

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

Draws a single layer of the map
public DrawLayer ( SpriteBatch spriteBatch, TiledLib.Layer layer, Camera gameCamera, Vector2 offset, float alpha, Color color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layer TiledLib.Layer
gameCamera Camera The camera to use for positioning.
offset Vector2 A pixel amount to offset the tile positioning by
alpha float Layer opacity.
color Color The color to use when drawing.
Результат void

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

Draws a single layer by layer name
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
Результат void

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

Draws a single layer by layer name, with a specified color
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Color color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
color Color
Результат void

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

Draws a single layer as shadows, by layer name
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Vector2 shadowOffset, float alpha ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
shadowOffset Vector2 Pixel amount to offset the shadowing by.
alpha float Shadow opacity
Результат void

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

Gets a layer by name.
public GetLayer ( string name ) : TiledLib.Layer
name string The name of the layer to retrieve.
Результат TiledLib.Layer

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

public Map ( Microsoft.Xna.Framework.Content.ContentManager content, string mapName ) : System
content Microsoft.Xna.Framework.Content.ContentManager
mapName string
Результат System

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

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