// Creates a new RoomStats object with the info, should be called at the start of each room private void CreateNewRoom() { // Call on the GameManager to get a seed string roomKey = GM.GenerateNewKey(); // Pick a random door to place the sign above int doorWithSign = Random.Range(0, 3); PlaceSign(doorWithSign); // Pick random thing for sign to say bool signSaysSafe_; int randomMessage = Random.Range(0, 2); if (randomMessage == 1) { signSaysSafe_ = true; signs[doorWithSign].gameObject.transform.GetChild(0).gameObject.SetActive(false); signs[doorWithSign].gameObject.transform.GetChild(1).gameObject.SetActive(true); print("THE SIGN SAYS SAFE"); } else { signSaysSafe_ = false; signs[doorWithSign].gameObject.transform.GetChild(1).gameObject.SetActive(false); signs[doorWithSign].gameObject.transform.GetChild(0).gameObject.SetActive(true); print("THE SIGN SAYS DEATH"); } // Roll to place a trap bool trapped = false; int aTrap = Random.Range(1, 5); if (aTrap == 1 && allRooms.Count > 0) // 25%, first room cannot be trapped { trapped = true; TE.StartTrap(); } // Create a new room with all of this info RoomStats newRoom = new RoomStats(); // Key Order: Rocks, Shrooms, Rats, Webs (as of right now, this will grow later) // Get the info from the new room key string[] roomNums = roomKey.Split('v'); int.TryParse(roomNums[0], out newRoom.numRocks); int.TryParse(roomNums[1], out newRoom.numShrooms); int.TryParse(roomNums[2], out newRoom.numRats); int.TryParse(roomNums[3], out newRoom.numWebs); int.TryParse(roomNums[4], out newRoom.numGems); int.TryParse(roomNums[5], out newRoom.numStalags); int.TryParse(roomNums[6], out newRoom.numCracks); // Set the ID newRoom.id = currentId; newRoom.roomTrapped = trapped; // is it trapped? newRoom.signLying = false; // default value of the sign lying newRoom.signLocation = doorWithSign; // which door is the sign above? (0, 1, 2) newRoom.entranceDoor = doorYouCameFrom; newRoom.signSaysSafe = signSaysSafe_; // does the sign say safe? // Set this room as the current one currentRoom = newRoom; // Apply all logic to find if the sign is truthful or not ruleBook.RunThroughRules(); // Increment the ID currentId++; // Add the bool value of signLying to the list of bools truthfulSigns.Add(!currentRoom.signLying); print(currentRoom.safeDoors[0] + ", " + currentRoom.safeDoors[1] + ", " + currentRoom.safeDoors[2]); canSelectRoom = true; }