Remove start and end room from rooms list
This commit is contained in:
parent
95c9f7aa1d
commit
fe9705b77e
1 changed files with 8 additions and 2 deletions
|
@ -7,10 +7,14 @@ public class DungeonGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public const int TUNNEL_THICKNESS = 4;
|
public const int TUNNEL_THICKNESS = 4;
|
||||||
|
// The first and starting room
|
||||||
public GenRoom start;
|
public GenRoom start;
|
||||||
|
// The room with the finishing flag
|
||||||
public GenRoom end;
|
public GenRoom end;
|
||||||
public HashSet<GenRoom> rooms;
|
// The room containing all the paths connecting normal rooms
|
||||||
public GenRoom path;
|
public GenRoom path;
|
||||||
|
// All rooms except the three above
|
||||||
|
public HashSet<GenRoom> rooms;
|
||||||
|
|
||||||
public void Generate() {
|
public void Generate() {
|
||||||
int minRoomSize = 50;
|
int minRoomSize = 50;
|
||||||
|
@ -137,13 +141,15 @@ public class DungeonGenerator {
|
||||||
foreach ( Vector2Int v in r.AllDoors() )
|
foreach ( Vector2Int v in r.AllDoors() )
|
||||||
r.tiles.Add(v, Room.TileType.DOOR);
|
r.tiles.Add(v, Room.TileType.DOOR);
|
||||||
}
|
}
|
||||||
rooms.Add(path);
|
|
||||||
|
|
||||||
start = root.r;
|
start = root.r;
|
||||||
end = null; foreach ( GenRoom r in rooms ) {
|
end = null; foreach ( GenRoom r in rooms ) {
|
||||||
if ( end == null || r.bounds.x > end.bounds.x )
|
if ( end == null || r.bounds.x > end.bounds.x )
|
||||||
end = r;
|
end = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rooms.Remove(start);
|
||||||
|
rooms.Remove(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddStraightHorizontal(HashSet<GenRoom> rooms, GenEdge ed) {
|
public static void AddStraightHorizontal(HashSet<GenRoom> rooms, GenEdge ed) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue