示例#1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int totalFunds = Sim.FamilyFunds - MinimumWealth;

            AddStat("Total Funds", totalFunds);

            List <Lot> lots = new List <Lot>();

            foreach (Lot lot in RentalHelper.GetPurchaseableLots(Manager, Sim.Household))
            {
                if (lot.Household == null)
                {
                    IncStat("Empty");
                    continue;
                }

                if (totalFunds < RentalHelper.GetPurchaseLotCost(lot))
                {
                    IncStat("Too Expensive");
                    continue;
                }

                lots.Add(lot);
            }

            AddStat("Choices", lots.Count);

            if (lots.Count == 0)
            {
                IncStat("No Choices");
                return(false);
            }

            mLot = RandomUtil.GetRandomObjectFromList(lots);

            RentalHelper.PurchaseRentalLot(Money, Sim.CreatedSim, mLot);
            return(true);
        }