From a0a48cb256419a227f93e097eb069c1144237385 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Tue, 24 Apr 2018 06:10:47 +0200 Subject: [PATCH] y *= -1 --- Assets/Scripts/Generation/DungeonGenerator.cs | 20 +++++++++---------- Assets/Scripts/Generation/GenRoom.cs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index ca39681..2e511b8 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -134,14 +134,14 @@ public class DungeonGenerator { r.tiles[new Vector2Int(x1, y1)].type = Room.TileType.GROUND; } allDoors.UnionWith(r.AllDoors()); + foreach (Vector2Int v in r.doorsDown) { + r.tiles[v].type = Room.TileType.DOOR; + r.tiles[v].position = GenTile.Position.DOWN; + } foreach (Vector2Int v in r.doorsUp) { r.tiles[v].type = Room.TileType.DOOR; r.tiles[v].position = GenTile.Position.TOP; } - foreach (Vector2Int v in r.doorsDown) { - r.tiles[v].type = Room.TileType.DOOR; - r.tiles[v].position = GenTile.Position.BOTTOM; - } foreach (Vector2Int v in r.doorsLeft) { r.tiles[v].type = Room.TileType.DOOR; r.tiles[v].position = GenTile.Position.LEFT; @@ -275,8 +275,8 @@ public class DungeonGenerator { rooms.Add(tunnel); for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) { - higher.doorsUp.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y + tunnel.bounds.height)); - lower.doorsDown.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y - 1)); + higher.doorsDown.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y + tunnel.bounds.height)); + lower.doorsUp.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y - 1)); } } @@ -394,22 +394,22 @@ public class DungeonGenerator { rooms.Add(verticalLefter); if ( lower == lefter ) for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) { - lower.doorsDown.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y - 1)); + lower.doorsUp.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y - 1)); } else for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) { - higher.doorsUp.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y + verticalLefter.bounds.height)); + higher.doorsDown.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y + verticalLefter.bounds.height)); } } if ( addVertical2 ) { rooms.Add(verticalRighter); if ( lower == righter ) for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) { - lower.doorsDown.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y - 1)); + lower.doorsUp.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y - 1)); } else for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) { - higher.doorsUp.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y + verticalRighter.bounds.height)); + higher.doorsDown.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y + verticalRighter.bounds.height)); } } } diff --git a/Assets/Scripts/Generation/GenRoom.cs b/Assets/Scripts/Generation/GenRoom.cs index c72452f..990c194 100644 --- a/Assets/Scripts/Generation/GenRoom.cs +++ b/Assets/Scripts/Generation/GenRoom.cs @@ -7,8 +7,8 @@ public class GenRoom { // TODO make them package protected please public RectInt bounds = new RectInt(); - public HashSet doorsUp = new HashSet(); public HashSet doorsDown = new HashSet(); + public HashSet doorsUp = new HashSet(); public HashSet doorsLeft = new HashSet(); public HashSet doorsRight = new HashSet(); @@ -38,8 +38,8 @@ public class GenRoom { public HashSet AllDoors() { HashSet ret = new HashSet(); - ret.UnionWith(doorsUp); ret.UnionWith(doorsDown); + ret.UnionWith(doorsUp); ret.UnionWith(doorsLeft); ret.UnionWith(doorsRight); return ret;