void GenerateRooms(Room room, Vector3Int pos, int depth) { depth++; //keeps track of distance from origin amount++; //total number of rooms RoomInformation info = room.roomInformation; //information about which sides are open Room newRoom; //the object to be instantiated, changes for each side //loop each side for (int i = 0; i < 4; i++) { //side from index RoomSide side = RoomInformation.GetSide(i); if (info.sideOpen(side)) { //accessing inverse list to find room that will fit int index = InverseIndex(i); newRoom = sideRooms[index][Random.Range(0, counts[index])]; HandleSide(pos, side, newRoom, depth); } } }
void FindRooms() { thisRoom = GetComponent <Room>(); //making sure origin is on list to be post processed generatedRooms.Add(thisRoom); foreach (Room room in rooms) { RoomInformation currentInfo = room.roomInformation; for (int i = 0; i < 4; i++) { sideRooms.Add(new List <Room>()); if (currentInfo.sideOpen(RoomInformation.GetSide(i))) { sideRooms[i].Add(room); counts[i]++; } } } }