//method to connect two rooms together void GenerateHallway(Room current, Room neighbor) { int size = CalcSize(); int[] c = current.getGridPos(size); int[] n = neighbor.getGridPos(size); //check if right if (n[0] > c[0]) { //delete the left wall tile on neighbor Vector3 nDoorPos = neighbor.shift + new Vector3(2f, 10f, 0f); roombuilder.CreateDoor(nDoorPos, neighbor, floorTile); //delete the right wall on current Vector3 cDoorPos = current.shift + new Vector3(17f, 10f, 0f); roombuilder.CreateDoor(cDoorPos, current, floorTile); //create door to connect the two rooms roombuilder.Hpath(cDoorPos, nDoorPos); } //check if above else if (n[1] > c[1]) { //delete the bottom wall tile on neighbor Vector3 nDoorPos = neighbor.shift + new Vector3(10f, 2f, 0f); roombuilder.CreateDoor(nDoorPos, neighbor, floorTile); //delete the top wall on current Vector3 cDoorPos = current.shift + new Vector3(10f, 17f, 0f); roombuilder.CreateDoor(cDoorPos, current, floorTile); //create door to connect the two rooms roombuilder.Vpath(cDoorPos, nDoorPos); } }