Chunk PutTwoWayChunk(Point currentPoint, Point parentPoint, Point otherPoint, double chamberProbability) { Chunk chunk = null; if ((((int)parentPoint.RelativeOrientationTo(currentPoint) - (int)otherPoint.RelativeOrientationTo(currentPoint)) % 2) == 0) { chunk = PutSraightTwoWayChunk(currentPoint, parentPoint, otherPoint, chamberProbability); } else { chunk = PutCornerTwoWayChunk(currentPoint, parentPoint, otherPoint, chamberProbability); } return chunk; }
Chunk PutThreeWayChunk(Point currentPoint, Point parentPoint, Point otherPoint1, Point otherPoint2, double chamberProbability) { Chunk chunk = InstantiateChunk(threeWayCorridorPrefab, threeWayChamberPrefab, chamberProbability, currentPoint); var orientationSum = (int)parentPoint.RelativeOrientationTo(currentPoint) + (int)otherPoint1.RelativeOrientationTo(currentPoint) + (int)otherPoint2.RelativeOrientationTo(currentPoint); if (orientationSum % 2 == 0) { if (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH || otherPoint1.RelativeOrientationTo(currentPoint) == Orientation.NORTH || otherPoint2.RelativeOrientationTo(currentPoint) == Orientation.NORTH) { chunk.Rotate(Orientation.NORTH); } else { chunk.Rotate(Orientation.SOUTH); } } else { if (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.EAST || otherPoint1.RelativeOrientationTo(currentPoint) == Orientation.EAST || otherPoint2.RelativeOrientationTo(currentPoint) == Orientation.EAST) { chunk.Rotate(Orientation.EAST); } else { chunk.Rotate(Orientation.WEST); } } Debug.Log ("Putting ThreeWayChunk at " + currentPoint + " with orientation towards " + chunk.chunkOrientation); return chunk; }
Chunk PutCornerTwoWayChunk(Point currentPoint, Point parentPoint, Point otherPoint, double chamberProbability) { Chunk chunk = InstantiateChunk(cornerPrefab, cornerChamberPrefab, chamberProbability, currentPoint); if ((parentPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.EAST) || (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.EAST && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH)) { chunk.Rotate(Orientation.NORTH); } else if ((parentPoint.RelativeOrientationTo(currentPoint) == Orientation.EAST && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.SOUTH) || (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.SOUTH && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.EAST)) { chunk.Rotate(Orientation.EAST); } else if ((parentPoint.RelativeOrientationTo(currentPoint) == Orientation.SOUTH && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.WEST) || (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.WEST && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.SOUTH)) { chunk.Rotate(Orientation.SOUTH); } else if ((parentPoint.RelativeOrientationTo(currentPoint) == Orientation.WEST && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH) || (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH && otherPoint.RelativeOrientationTo(currentPoint) == Orientation.WEST)) { chunk.Rotate(Orientation.WEST); } Debug.Log ("Putting CornerChunk at " + currentPoint + " with orientation towards " + chunk.chunkOrientation); return chunk; }
Chunk PutSraightTwoWayChunk(Point currentPoint, Point parentPoint, Point otherPoint, double chamberProbability) { Chunk chunk = InstantiateChunk(twoWayCorridorPrefab, twoWayChamberPrefab, chamberProbability, currentPoint); if (parentPoint.RelativeOrientationTo(currentPoint) == Orientation.SOUTH || parentPoint.RelativeOrientationTo(currentPoint) == Orientation.NORTH) { chunk.Rotate(Orientation.NORTH); } else { chunk.Rotate(Orientation.EAST); } Debug.Log ("Putting TwoWayChunk at " + currentPoint + " with orientation towards " + chunk.chunkOrientation); return chunk; }
Chunk PutChamber(Point currentPoint, Point parentPoint) { var chunk = InstantiateChunk(chamberPrefab, chamberPrefab, chamberProbability, currentPoint); chunk.Rotate(parentPoint.RelativeOrientationTo(currentPoint)); Debug.Log ("Putting Chamber at " + currentPoint + " with orientation towards " + chunk.chunkOrientation); return chunk; }