コード例 #1
0
        void SplitChunk(FloorChunk Chunk, FloorChunk OutLeft, FloorChunk OutRight)
        {
            int MinRoomLength = floorPlanConfig.MinRoomSize;
            int Length        = Chunk.GetLength();
            int LengthLeft    = MinRoomLength + random.Next(0, Mathf.Max(0, Length - MinRoomLength * 2));
            int LengthRight   = Length - LengthLeft;

            OutLeft.Bounds    = Chunk.Bounds;
            OutLeft.ChunkType = FloorChunkType.Room;
            OutLeft.SetLength(LengthLeft);

            OutRight.Bounds = Chunk.Bounds;
            OutRight.OffsetAlongLength(LengthLeft);
            OutRight.ChunkType = FloorChunkType.Room;
            OutRight.SetLength(LengthRight);
        }
コード例 #2
0
        void SplitChunk(FloorChunk Chunk, FloorChunk OutLeft, FloorChunk OutRight, FloorChunk OutHallway)
        {
            int HallWidth       = floorPlanConfig.HallWidth;
            int Length          = Chunk.GetLength();
            int RemainingLength = Length - HallWidth;
            int MinChunkLength  = floorPlanConfig.MinRoomSize;
            int LengthLeft      = MinChunkLength + random.Next(0, Mathf.Max(0, RemainingLength - MinChunkLength * 2 + 1));
            int LengthRight     = RemainingLength - LengthLeft;

            OutLeft.Bounds    = Chunk.Bounds;
            OutLeft.ChunkType = FloorChunkType.Room;
            OutLeft.SetLength(LengthLeft);

            OutHallway.Bounds    = Chunk.Bounds;
            OutHallway.ChunkType = FloorChunkType.Hall;
            OutHallway.OffsetAlongLength(LengthLeft);
            OutHallway.SetLength(HallWidth);

            OutRight.Bounds    = Chunk.Bounds;
            OutRight.ChunkType = FloorChunkType.Room;
            OutRight.OffsetAlongLength(LengthLeft + HallWidth);
            OutRight.SetLength(LengthRight);
        }