void mergeWall(Wall.Inner wall) { foreach (RoomWall roomWall in roomWalls) { if (wall.isSameWall(roomWall.wall)) { roomWall.addWall(wall); return; } } roomWalls.Add(new RoomWall(wall, room)); }
public Room(int i) { if (i <= 13) { room = new Block[emptyRoomTemplate.GetLength(0), emptyRoomTemplate.GetLength(1)]; for (int y = 0; y < emptyRoomTemplate.GetLength(0); y++) { for (int x = 0; x < emptyRoomTemplate.GetLength(1); x++) { if (emptyRoomTemplate[y, x] == 0) { room[y, x] = new EmptySpace(); } else if (emptyRoomTemplate[y, x] == 1) { room[y, x] = new Wall.Outer(); } else if (emptyRoomTemplate[y, x] == 2) { Wall.Inner wall; if (emptyRoomTemplate[y, x - 1] == 2 || emptyRoomTemplate[y, x - 1] == 1) { int min = Math.Min(emptyRoomTemplate[y - 1, x] - 2, emptyRoomTemplate[y + 1, x] - 2); int max = Math.Max(emptyRoomTemplate[y - 1, x] - 2, emptyRoomTemplate[y + 1, x] - 2); wall = new Wall.Inner(min, max, x, y); } else { int min = Math.Min(emptyRoomTemplate[y, x - 1] - 2, emptyRoomTemplate[y, x + 1] - 2); int max = Math.Max(emptyRoomTemplate[y, x - 1] - 2, emptyRoomTemplate[y, x + 1] - 2); wall = new Wall.Inner(min, max, x, y); } room[y, x] = wall; mergeWall(wall); } else { room[y, x] = new Floor.Vanilla(); } } } createTree(); shuffleList(); explodeWalls(); } else { room = new Block[treasureRoomTemplate.GetLength(0), treasureRoomTemplate.GetLength(1)]; for (int y = 0; y < treasureRoomTemplate.GetLength(0); y++) { for (int x = 0; x < treasureRoomTemplate.GetLength(1); x++) { if (treasureRoomTemplate[y, x] == 1) { room[y, x] = new Wall.Outer(); } else { room[y, x] = new Floor.Vanilla(); } } } } }
public RoomWall(Wall.Inner wall, Block[,] room) { this.room = room; this.wall = wall; addWall(wall); }
public void addWall(Wall.Inner wall) { walls.Add(wall); }
public bool isSameWall(Wall.Inner other) { return(this.top == other.top && this.bottom == other.bottom); }