Пример #1
0
        private void PlaceEntrance()
        {
            DungeonPosition position = GetRandomExteriorPosition();

            EntranceLocation = position;
            Rooms[position.Y][position.X] = new Entrance();
        }
Пример #2
0
        private void PlaceExit()
        {
            DungeonPosition position = GetRandomExteriorPosition();

            do
            {
                position = GetRandomExteriorPosition();
            } while (position.Equals(EntranceLocation));

            ExitLocation = position;
            Rooms[position.Y][position.X] = new Exit();
        }
Пример #3
0
        private void PlacePillars()
        {
            Random          rand     = new Random();
            DungeonPosition position = null;

            for (int pillarsPlaced = 0; pillarsPlaced < 4;)
            {
                position = new DungeonPosition(rand.Next(Width), rand.Next(Height));
                if (Rooms[position.Y][position.X] is StandardRoom)
                {
                    StandardRoom room = (StandardRoom)Rooms[position.Y][position.X];

                    if (!room.HasPillar)
                    {
                        room.HasPillar = true;
                        pillarsPlaced++;
                    }
                }
            }
        }