From fe9705b77e0640c0dc230306dfc000274a4f38d9 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Sun, 22 Apr 2018 16:27:31 +0200 Subject: [PATCH] Remove start and end room from rooms list --- Assets/Scripts/Generation/DungeonGenerator.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index ccce4a2..c65e132 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -7,10 +7,14 @@ public class DungeonGenerator { } public const int TUNNEL_THICKNESS = 4; + // The first and starting room public GenRoom start; + // The room with the finishing flag public GenRoom end; - public HashSet rooms; + // The room containing all the paths connecting normal rooms public GenRoom path; + // All rooms except the three above + public HashSet rooms; public void Generate() { int minRoomSize = 50; @@ -137,13 +141,15 @@ public class DungeonGenerator { foreach ( Vector2Int v in r.AllDoors() ) r.tiles.Add(v, Room.TileType.DOOR); } - rooms.Add(path); start = root.r; end = null; foreach ( GenRoom r in rooms ) { if ( end == null || r.bounds.x > end.bounds.x ) end = r; } + + rooms.Remove(start); + rooms.Remove(end); } public static void AddStraightHorizontal(HashSet rooms, GenEdge ed) {