private CS_Room OpenDoor(CS_Door door) { GameObject openRoom = Instantiate <GameObject>(roomTypes[door.destinationRoomIndex]); //Instantiate a copy of the object CS_Room destinationRoom = openRoom.GetComponent <CS_Room>(); destinationRoom.InitializeRoom(door.transform, door.destinationDoorIndex); return(destinationRoom); }
//Random open is for demo purposes. It just makes a random connection from a random door. private CS_Room RandomOpen(CS_Door door) { GameObject openRoom = Instantiate <GameObject>(roomTypes[Random.Range(0, roomTypes.Length)]); //Instantiate a copy of the object CS_Room destinationRoom = openRoom.GetComponent <CS_Room>(); destinationRoom.InitializeRoom(door.transform, Random.Range(0, destinationRoom.doors.Length - 1)); return(destinationRoom); }