示例#1
0
        private void TryAddRoom()
        {
            Room room = Corridors.Any() ? Corridors.Last().SpawnRoom(15, 15) : new Room(new Position(50, 50), 10, 10);

            if (!DungeonValidator.CanFeatureBeAdded(room, OccupiedPoints))
            {
                return;
            }

            Rooms.Add(room);
            foreach (var p in room.GetPositions())
            {
                OccupiedPoints.Add(p.Key, p.Value);
            }
        }
示例#2
0
        private void TryAddCorridor()
        {
            if (!Rooms.Any())
            {
                return;
            }
            var corridor = Rooms.Last().SpawnCorridor(DMHelper.GetRandomDirection());

            if (!DungeonValidator.CanFeatureBeAdded(corridor, OccupiedPoints))
            {
                return;
            }

            Corridors.Add(corridor);

            foreach (var p in corridor.GetPositions())
            {
                OccupiedPoints.Add(p.Key, p.Value);
            }
        }