Ejemplo n.º 1
0
 protected UpdateAgingScenario(UpdateAgingScenario scenario)
     : base(scenario)
 {
 }
Ejemplo n.º 2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int autoToastDreams = GetValue <AutoToastDreamsOption, int>();

            if (autoToastDreams > 0)
            {
                if ((OldHouse != null) && (NewHouse != null))
                {
                    foreach (SimDescription sim in CommonSpace.Helpers.Households.All(NewHouse))
                    {
                        if (sim.CreatedSim == null)
                        {
                            continue;
                        }

                        DreamsAndPromisesManager dnpManager = sim.CreatedSim.DreamsAndPromisesManager;
                        if (dnpManager == null)
                        {
                            continue;
                        }

                        if (dnpManager.mDreamNodes == null)
                        {
                            continue;
                        }

                        int numPromised = dnpManager.NumPromisedDreams();

                        if (sim.LifetimeWishNode != null)
                        {
                            numPromised--;
                        }

                        if (numPromised > 0)
                        {
                            continue;
                        }

                        IncStat("Dropping Dreams");

                        int remainingToastDreams = autoToastDreams;
                        while ((remainingToastDreams > 0) &&
                               (dnpManager.mDreamNodes.Count > 0))
                        {
                            dnpManager.CancelDream(dnpManager.mDreamNodes[0]);

                            remainingToastDreams--;

                            IncStat("Dropped Starting Dream");
                        }
                    }
                }
            }

            UpdateAgingScenario updateAging = new UpdateAgingScenario();

            updateAging.Manager = Sims;

            updateAging.Perform(CommonSpace.Helpers.Households.All(NewHouse), frame);
            updateAging.Perform(CommonSpace.Helpers.Households.All(OldHouse), frame);
            return(false);
        }