Ejemplo n.º 1
0
        public override void ApplyToPath(IRandom rand, FloorPlan floorPlan)
        {
            int amount = this.Amount.Pick(rand);

            for (int kk = 0; kk < amount; kk++)
            {
                FloorPathBranch <T> .ListPathBranchExpansion?expansionResult = this.ChooseRoomExpansion(rand, floorPlan);

                if (!expansionResult.HasValue)
                {
                    continue;
                }

                var expansion = expansionResult.Value;

                RoomHallIndex from = expansion.From;
                if (expansion.Hall != null)
                {
                    floorPlan.AddHall(expansion.Hall, this.HallComponents.Clone(), from);
                    from = new RoomHallIndex(floorPlan.HallCount - 1, true);
                }

                floorPlan.AddRoom(expansion.Room, this.RoomComponents.Clone(), from);

                GenContextDebug.DebugProgress("Extended with Room");
            }
        }
Ejemplo n.º 2
0
        public virtual FloorPathBranch <T> .ListPathBranchExpansion?ChooseRoomExpansion(IRandom rand, FloorPlan floorPlan)
        {
            List <RoomHallIndex> availableExpansions = new List <RoomHallIndex>();

            for (int ii = 0; ii < floorPlan.RoomCount; ii++)
            {
                if (!BaseRoomFilter.PassesAllFilters(floorPlan.GetRoomPlan(ii), this.Filters))
                {
                    continue;
                }
                availableExpansions.Add(new RoomHallIndex(ii, false));
            }

            for (int ii = 0; ii < floorPlan.HallCount; ii++)
            {
                if (!BaseRoomFilter.PassesAllFilters(floorPlan.GetHallPlan(ii), this.Filters))
                {
                    continue;
                }
                availableExpansions.Add(new RoomHallIndex(ii, true));
            }

            return(FloorPathBranch <T> .ChooseRoomExpansion(this.PrepareRoom, this.HallPercent, rand, floorPlan, availableExpansions));
        }