1
0
Fork 0

Door rotation

Not tested
This commit is contained in:
Piegames 2018-04-24 05:27:34 +02:00
parent 9538e6729f
commit fb2ba06537
2 changed files with 18 additions and 11 deletions

View file

@ -134,12 +134,21 @@ public class DungeonGenerator {
r.tiles[new Vector2Int(x1, y1)].type = Room.TileType.GROUND; r.tiles[new Vector2Int(x1, y1)].type = Room.TileType.GROUND;
} }
allDoors.UnionWith(r.AllDoors()); allDoors.UnionWith(r.AllDoors());
foreach ( Vector2Int v in r.AllDoors() ) { foreach (Vector2Int v in r.doorsUp) {
//Debug.Log("Door: " + v);
if ( !r.bounds.Contains(v) )
throw new NotSupportedException("This is a bug where doors land in the wrong room. It should have been fixed.");
else
r.tiles[v].type = Room.TileType.DOOR; 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;
}
foreach (Vector2Int v in r.doorsRight) {
r.tiles[v].type = Room.TileType.DOOR;
r.tiles[v].position = GenTile.Position.RIGHT;
} }
} }
@ -458,8 +467,7 @@ public class DungeonGenerator {
case 1: { case 1: {
// Scorpion Attack!!!!: // Scorpion Attack!!!!:
List<GameObject> lg = new List<GameObject>(); List<GameObject> lg = new List<GameObject>();
int count = Math.Min(UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count)), 5); int count = Math.Min(UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count)), 4);
Debug.Log(count + " scorpions (of " + r.GetSpawnpoints().Count);
for ( int c = 0; c < count; c++ ) { for ( int c = 0; c < count; c++ ) {
lg.Add(enemyPrefabs[Entity.Entities.SCORPION]); lg.Add(enemyPrefabs[Entity.Entities.SCORPION]);
} }
@ -471,8 +479,7 @@ public class DungeonGenerator {
case 3: { case 3: {
// Bug Attack!!!!: // Bug Attack!!!!:
List<GameObject> lg = new List<GameObject>(); List<GameObject> lg = new List<GameObject>();
int count = Math.Min(UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count)), 10); int count = Math.Min(UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count)), 7);
Debug.Log(count + " bugs (of " + r.GetSpawnpoints().Count);
for ( int c = 0; c < count; c++ ) { for ( int c = 0; c < count; c++ ) {
lg.Add(enemyPrefabs[Entity.Entities.BUG]); lg.Add(enemyPrefabs[Entity.Entities.BUG]);
} }