Exemple #1
0
        private void CreateRoom(int x, int y, bool startOrLast = false)
        {
            Rooms[y, x] = new Room(x, y, startOrLast);
            TileMap3D tileMap = new TileMap3D();

            tileMap.Room = Rooms[y, x];

            tileMap.Offset = new Point(x * 320, y * 320);
            tileMap.Offset = IsometricTools.To3D(tileMap.Offset);

            Rooms[y, x].TileMap = tileMap;

            createdRooms.Add(Rooms[y, x]);
        }
Exemple #2
0
 public override void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     if (Room == null)
     {
         return;
     }
     for (int r = 0; r < Room.Width; r++)
     {
         for (int c = 0; c < Room.Height; c++)
         {
             int id = GetTileId(r, c);
             if (id > 0)
             {
                 Point pos = new Point(c * TileWidth, r * TileHeight);
                 pos = IsometricTools.To3D(pos);
                 Texture2D texture = textures[id - 1];
                 if (texture != null)
                 {
                     spriteBatch.Draw(texture, new Rectangle(pos + Offset - camera.Coords, new Point(texture.Width, texture.Height)), Color.White);
                 }
             }
         }
     }
 }