connect multiple rooms with doors
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user