public void OnChangeRoom(RoomTemplate template) { if (currentRoom.gameObject.transform.GetSiblingIndex() != template.gameObject.transform.GetSiblingIndex()) { currentRoom.DeactivateRoom(); currentRoom = template; currentRoom.ActivateRoom(); } }
private void CreateRooms() { roomList = new List <RoomTemplate>(); RoomTemplate roomPrefab = GetRoomTemplate(RoomsTypes.C).GetComponent <RoomTemplate>(); RoomTemplate room = Instantiate(roomPrefab, transform.position, roomPrefab.transform.rotation, roomsContainer); startRoom = room; currentRoom = startRoom; currentRoom.ActivateRoom(); AddRoom(room); }