Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1.         // Check each side of room and decide on wall or coridor.
  2.         for(int i = 0; i < 4;i++) {
  3.             rndBool = (Random.value < 0.5f); // rng
  4.  
  5.             // Check location of adjacent room.
  6.             Vector3 positionCheck = thisRoom.transform.localPosition + getRoomLocation(i);
  7.             adjacentRoom = getRoomByLocation(positionCheck);
  8.  
  9.             if(adjacentRoom != null) {
  10.                 // If room found
  11.                 roomOk = false; // Do not make room there
  12.                 if(adjacentRoom.GetComponent<Room>().walls[getOppositeWall(i)] == false) { // If adjacent room has coridor facing this way, do not make a wall
  13.                     isWall = false;
  14.                 } else {
  15.                     isWall = true;
  16.                 }
  17.  
  18.             } else {
  19.                 // If no room found
  20.                 roomOk = true;
  21.  
  22.                 // Absolutes
  23.                 if(roomsMade.Count >= roomsToMake) {
  24.                     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
  25.                 }else      
  26.                 if(wallsMade >= 3 && roomsMade.Count < roomsToMake) { // If there are enough walls and not enough rooms, do not make a wall.
  27.                     isWall = false;
  28.                 }else
  29.            
  30.                 // RNG
  31.                 if(wallsMade < 3 && roomsMade.Count < roomsToMake) { // If there aren't enough rooms and walls, ask RNGesus
  32.                     isWall = rndBool;
  33.                 }
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement