connect multiple rooms with doors

This commit is contained in:
2022-11-03 21:20:00 +01:00
parent bce88d0504
commit 807eae1c62
24 changed files with 391 additions and 88 deletions

View File

@@ -6,8 +6,8 @@ namespace Escape_Room_Engine.Engine.Scripts
public class Room
{
internal Passage entrance, exit;
internal GameObject roomObject;
private GameObject _roomObject;
private List<Space> _spaces = new();
internal Room(Passage entrance)
@@ -23,12 +23,12 @@ namespace Escape_Room_Engine.Engine.Scripts
internal void InstantiateRoom(Transform parent, string name)
{
_roomObject = new GameObject($"Room {name}");
_roomObject.transform.SetParent(parent, false);
roomObject = new GameObject($"Room {name}");
roomObject.transform.SetParent(parent, false);
for (var i = 0; i < _spaces.Count; i++)
{
_spaces[i].InstantiateSpace(_roomObject.transform, i.ToString());
_spaces[i].InstantiateSpace(roomObject.transform, i.ToString());
}
}
@@ -38,7 +38,7 @@ namespace Escape_Room_Engine.Engine.Scripts
{
space.Destroy();
}
Object.Destroy(_roomObject);
Object.Destroy(roomObject);
}
}
}