Exemplo n.º 1
0
        public override Tile[][] getTiles()
        {
            Tile[][] tiles = new Tile[bounds.h][];

            for (int i = 0; i < bounds.h; i++) {
                tiles[i] = new Tile[bounds.w];
                for (int j = 0; j < bounds.w; j++) {
                    if (i == 0 || j == 0 || j == bounds.w - 1 || i == bounds.h - 1) {
                        tiles[i][j] = new TileWall(bounds.x + j, bounds.y + i);
                    } else {
                        tiles[i][j] = new TileFloor(bounds.x + j, bounds.y + i);
                    }
                }
            }

            return tiles;
        }
Exemplo n.º 2
0
        public Tile[][] getTiles()
        {
            Rectangle size = getTrimmedSize();
            Tile[][] theTiles = new Tile[size.h][];

            for (int i = 0; i < size.h; i++) {
                theTiles[i] = new Tile[size.w];
                for (int j = 0; j < size.w; j++) {
                    theTiles[i][j] = new TileEmpty(i, j);
                }
            }

            foreach (var room in rooms) {
                Tile[][] roomTiles = room.getTiles();
                for (int i = 0; i < roomTiles.Length; i++) {
                    for (int j = 0; j < roomTiles[i].Length; j++) {
                        Tile tile = roomTiles[i][j];
                        tile.x -= size.x;
                        tile.y -= size.y;
                        theTiles[tile.y][tile.x] = tile;
                    }
                }
            }

            return theTiles;
        }