damongant

Untitled

Apr 24th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. public class Map
  2. {
  3. List<MapTile> tiles;
  4.  
  5. public List<MapTile> Tiles
  6. {
  7. get { return tiles; }
  8. set { tiles = value; }
  9. }
  10.  
  11. public IOrderedEnumerable<MapTile> GetTilesInDrawOrder()
  12. {
  13. return from x in Tiles
  14. orderby x.Layer ascending
  15. select x;
  16. }
  17. }
  18.  
  19. public class MapTile
  20. {
  21. Point position;
  22.  
  23. public Point Position
  24. {
  25. get { return position; }
  26. set { position = value; }
  27. }
  28.  
  29. string tilesetHash;
  30.  
  31. public string TilesetHash
  32. {
  33. get { return tilesetHash; }
  34. set { tilesetHash = value; }
  35. }
  36.  
  37. Point tilesetOffset;
  38.  
  39. public Point TilesetOffset
  40. {
  41. get { return tilesetOffset; }
  42. set { tilesetOffset = value; }
  43. }
  44.  
  45. int layer;
  46.  
  47. public int Layer
  48. {
  49. get { return layer; }
  50. set { layer = value; }
  51. }
  52.  
  53. PlayerPass playerPass;
  54.  
  55. public PlayerPass PlayerPass
  56. {
  57. get { return playerPass; }
  58. set { playerPass = value; }
  59. }
  60.  
  61. public Texture2D GetTexture()
  62. {
  63. return Utils.g.Service<AssetCache>().GetAsset<Tileset>(tilesetHash).GetTexture(Utils.g.GraphicsDevice);
  64. }
  65.  
  66. public Rectangle GetSourceRect()
  67. {
  68. return new Rectangle((int)TilesetOffset.X-1 * Utils.TILESIZE, (int)TilesetOffset.Y-1 * Utils.TILESIZE, Utils.TILESIZE, Utils.TILESIZE);
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment