Exemple #1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            mRequirement.mFertile = true;

            if (BabyGenderScenario.GetGenderByFirstBorn(Manager, GetValue <ImmigrateScenario.GenderOption, BabyGenderScenario.FirstBornGender>(), false) == CASAgeGenderFlags.Male)
            {
                mRequirement.mNeedMale = true;
            }
            else
            {
                mRequirement.mNeedFemale = true;
            }
            return(true);
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (mNewSim != null)
            {
                mSpecies = mNewSim.Species;
            }

            if (HouseholdsEx.IsFull(this, Sim.Household, mSpecies, 0, true, true))
            {
                IncStat("Full");
                return(false);
            }

            bool created = false;

            if (mNewSim == null)
            {
                using (SimFromBin <ManagerLot> simBin = new SimFromBin <ManagerLot>(this, Lots))
                {
                    CASAgeGenderFlags gender = BabyGenderScenario.GetGenderByFirstBorn(Manager, GetValue <ImmigrateScenario.GenderOption, BabyGenderScenario.FirstBornGender>(), false);

                    mNewSim = simBin.CreateNewSim(Ages, gender, mSpecies);
                    created = true;
                }
            }

            if (mNewSim != null)
            {
                if (Households.MoveSim(mNewSim, Sim.Household))
                {
                    mNewSim.LastName   = Sim.LastName;
                    mNewSim.WasAdopted = true;

                    Relationship relation = ManagerSim.GetRelationship(Sim, mNewSim);
                    if (relation != null)
                    {
                        relation.LTR.SetLiking(Delta);
                    }

                    Relationships.CheckAddHumanParentFlagOnAdoption(Sim, mNewSim);

                    if (Sim.Partner != null)
                    {
                        Relationships.CheckAddHumanParentFlagOnAdoption(Sim.Partner, mNewSim);
                    }

                    if (SimTypes.IsEquivalentSpecies(mNewSim, Sim))
                    {
                        Sim.Genealogy.AddChild(mNewSim.Genealogy);
                    }

                    UpdateDayOfLastOption(Sim);

                    if ((Sim.Partner != null) && (Sim.IsMarried))
                    {
                        if (SimTypes.IsEquivalentSpecies(mNewSim, Sim))
                        {
                            Sim.Partner.Genealogy.AddChild(mNewSim.Genealogy);
                        }

                        UpdateDayOfLastOption(Sim.Partner);
                    }
                    return(true);
                }
                else if (created)
                {
                    mNewSim.Dispose();
                    mNewSim = null;
                }
            }

            IncStat("No New Sim");
            return(false);
        }