コード例 #1
0
 public void FillRoomToDoor()
 {
     while (OpenDoorList.Any())
     {
         var i = OpenDoorList.Count - 1;
         RoomPosition.CheckRoomPosition(DungeonTiles, OpenDoorList[i].I, OpenDoorList[i].J);
         if (CheckPos())
         {
             if (RoomPosition.Up)
             {
                 RandomFillUpDown(OpenDoorList[i].I + 1, OpenDoorList[i].J, OpenDoorList[i]);
             }
             else if (RoomPosition.Down)
             {
                 RandomFillUpDown(OpenDoorList[i].I - 1, OpenDoorList[i].J, OpenDoorList[i]);
             }
             else if (RoomPosition.Right)
             {
                 RandomFillLeftRight(OpenDoorList[i].I, OpenDoorList[i].J - 1, OpenDoorList[i]);
             }
             else if (RoomPosition.Left)
             {
                 RandomFillLeftRight(OpenDoorList[i].I, OpenDoorList[i].J + 1, OpenDoorList[i]);
             }
         }
         OpenDoorList.Remove(OpenDoorList[i]);
     }
 }
コード例 #2
0
        public override void AddEntryPoint()
        {
            bool entryIsOk;
            int  x;
            int  y;

            do
            {
                x = _dungeonHelper.GetRandomInt(1, DungeonTiles.Length - 1);
                y = _dungeonHelper.GetRandomInt(1, DungeonTiles.Length - 1);
                RoomPosition.CheckRoomPosition(DungeonTiles, x, y);
                entryIsOk = DungeonTiles[x][y].Texture == Textures.ROOM_EDGE && CheckPos() && CheckNearbyDoor(DungeonTiles[x][y]) && CheckEdges(DungeonTiles, x, y);
            }while (!entryIsOk);
            DungeonTiles[x][y].Texture = Textures.ENTRY;
        }