Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check each side of room and decide on wall or coridor.
- for(int i = 0; i < 4;i++) {
- rndBool = (Random.value < 0.5f); // rng
- // Check location of adjacent room.
- Vector3 positionCheck = thisRoom.transform.localPosition + getRoomLocation(i);
- adjacentRoom = getRoomByLocation(positionCheck);
- if(adjacentRoom != null) {
- // If room found
- roomOk = false; // Do not make room there
- if(adjacentRoom.GetComponent<Room>().walls[getOppositeWall(i)] == false) { // If adjacent room has coridor facing this way, do not make a wall
- isWall = false;
- } else {
- isWall = true;
- }
- } else {
- // If no room found
- roomOk = true;
- // Absolutes
- if(roomsMade.Count >= roomsToMake) {
- isWall = true; // If there are enough rooms, A wall will always be made. Must go through a second time later to close previously made coridors
- }else
- if(wallsMade >= 3 && roomsMade.Count < roomsToMake) { // If there are enough walls and not enough rooms, do not make a wall.
- isWall = false;
- }else
- // RNG
- if(wallsMade < 3 && roomsMade.Count < roomsToMake) { // If there aren't enough rooms and walls, ask RNGesus
- isWall = rndBool;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement