void SetTutorialRoom() { for (int i = 0; i < Doors.Length; ++i) { if (Doors[i].roomNumber == 1) { tutorialDoors.Add(Doors[i]); } } for (int i = 0; i < Speakers.Length; ++i) { if (Speakers[i].roomNumber == 1) { tutorialSpeaker = Speakers[i]; tutorialSpeaker.genCode(); tutorialSpeaker.setActive(true); } } for (int i = 0; i < tutorialDoors.Count; ++i) { tutorialDoors[i].SetCode(tutorialSpeaker.getCode()); } }
void SetRooms() { // First Speaker int selectedRoom = Random.Range(0, listOfRooms.Count); int counter = 1; while (listOfRooms.Count > 0 && counter <= numOfChains) { Debug.Log("Rooms Left: " + listOfRooms.Count + "\nRoom chain #" + counter + " is in Room #" + listOfRooms[selectedRoom]); CodeVoice speaker = null; for (int i = 0; i < Speakers.Length; ++i) { if (Speakers[i].roomNumber == listOfRooms[selectedRoom]) { speaker = Speakers[i]; speaker.genCode(); speaker.setActive(true); } } if (speaker == null) { Debug.Log("Well shit, that didn't turn out so well!"); } else { Debug.Log("Cool, speaker isn't null for first room!"); } ++counter; if (listOfRooms.Count > 1 && counter <= numOfChains) { Debug.Log("Chaining the rooms " + listOfRooms[selectedRoom]); // Link to new door listOfRooms.RemoveAt(selectedRoom); selectedRoom = Random.Range(0, listOfRooms.Count); for (int i = 0; i < Doors.Length; ++i) { if (Doors[i].roomNumber == listOfRooms[selectedRoom]) { Doors[i].SetCode(speaker.getCode()); } } } else { counter = numOfChains + 1; Debug.Log("Last Room gots to be chained to the exit"); //for(int i = 0; i < ExitDoors.Count; ++i) if (listOfExitDoorGroups.Count > 0) { Debug.Log("Creating Exit " + listOfExitDoorGroups.Count); int randomExit = Random.Range(0, listOfExitDoorGroups.Count); Debug.Log("Exit #" + randomExit + " has been selected"); for (int i = 0; i < ExitDoors.Count; ++i) { if (ExitDoors[i].exitNumber == listOfExitDoorGroups[randomExit]) { ExitDoors[i].SetCode(speaker.getCode()); } } } else { Debug.Log("ERROR: NO EXIT EXISTS"); } } } }