Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Map
- {
- List<MapTile> tiles;
- public List<MapTile> Tiles
- {
- get { return tiles; }
- set { tiles = value; }
- }
- public IOrderedEnumerable<MapTile> GetTilesInDrawOrder()
- {
- return from x in Tiles
- orderby x.Layer ascending
- select x;
- }
- }
- public class MapTile
- {
- Point position;
- public Point Position
- {
- get { return position; }
- set { position = value; }
- }
- string tilesetHash;
- public string TilesetHash
- {
- get { return tilesetHash; }
- set { tilesetHash = value; }
- }
- Point tilesetOffset;
- public Point TilesetOffset
- {
- get { return tilesetOffset; }
- set { tilesetOffset = value; }
- }
- int layer;
- public int Layer
- {
- get { return layer; }
- set { layer = value; }
- }
- PlayerPass playerPass;
- public PlayerPass PlayerPass
- {
- get { return playerPass; }
- set { playerPass = value; }
- }
- public Texture2D GetTexture()
- {
- return Utils.g.Service<AssetCache>().GetAsset<Tileset>(tilesetHash).GetTexture(Utils.g.GraphicsDevice);
- }
- public Rectangle GetSourceRect()
- {
- return new Rectangle((int)TilesetOffset.X-1 * Utils.TILESIZE, (int)TilesetOffset.Y-1 * Utils.TILESIZE, Utils.TILESIZE, Utils.TILESIZE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment