Пример #1
0
        public void Decorate(Floor floor, MapArea area, IGenerator rng)
        {
            MapArea restrictedArea = new MapArea();

            restrictedArea.Add(area.Positions);
            restrictedArea.Remove(area.Bounds.PerimeterPositions());

            Placeable.Place(floor, restrictedArea.RandomPosition(rng), rng);
        }
Пример #2
0
        public void Decorate(Floor floor, MapArea area, IGenerator rng)
        {
            MapArea restrictedArea = new MapArea();

            restrictedArea.Add(area.Positions);
            restrictedArea.Remove(area.Bounds.PerimeterPositions());

            int amount       = Math.Min(rng.Next(MinAmount, MaxAmount + 1), restrictedArea.Count);
            int amountPlaced = 0;

            while (amountPlaced < amount)
            {
                if (Placeable.Place(floor, restrictedArea.RandomPosition(rng), rng))
                {
                    amountPlaced += 1;
                }
            }
        }