Exemplo n.º 1
0
        public new List <SimDescription> CreateNewbornsBeforePacking(float bonusMoodPoints, bool bAddToFamily, int householdSimMembers, int householdPetMembers)
        {
            MiniSimDescription miniDescription = null;
            SimDescription     description;

            if (mDad == null || mDad.HasBeenDestroyed)
            {
                description = SimDescription.Find(DadDescriptionId);

                if (description == null)
                {
                    miniDescription = MiniSimDescription.Find(DadDescriptionId);

                    if (miniDescription != null)
                    {
                        description = miniDescription.UnpackSim();
                        description.Genealogy.SetSimDescription(description);
                    }
                }
            }
            else
            {
                description = mDad.SimDescription;
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(description, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numForBirth         = GetNumForBirth(description, pregoRandom, householdSimMembers, householdPetMembers);
            Random gen = new Random(mRandomGenSeed);
            List <SimDescription> list = new List <SimDescription>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription description2 = AlienUtilsEx.MakeAlienBaby(description, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, false);
                description2.WasCasCreated = false;

                if (bAddToFamily)
                {
                    mMom.Household.Add(description2);
                    Sim sim = description2.Instantiate(mMom.Position);
                    CheckForGhostBaby(sim);
                }

                list.Add(description2);
            }

            if (miniDescription != null)
            {
                description.Dispose(true, true);
            }

            return(list);
        }
Exemplo n.º 2
0
        public override List <Sim> CreateNewborns(float bonusMoodPoints, bool interactive, bool homeBirth)
        {
            SimDescription     alien     = null;
            MiniSimDescription miniAlien = null;

            if (mDad != null && !mDad.HasBeenDestroyed)
            {
                alien = mDad.SimDescription;
            }

            if (alien == null)
            {
                alien = SimDescription.Find(DadDescriptionId);

                if (alien == null)
                {
                    miniAlien = MiniSimDescription.Find(DadDescriptionId);

                    if (miniAlien != null)
                    {
                        alien = miniAlien.UnpackSim();

                        if (alien != null)
                        {
                            Household household = Household.Create(false);

                            if (household != null)
                            {
                                household.AddTemporary(alien);
                                alien.Genealogy.SetSimDescription(alien);
                            }
                        }
                        else
                        {
                            miniAlien = null;
                        }
                    }
                }
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(alien, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numSimMembers       = 0;
            int    numPetMembers       = 0;

            mMom.Household.GetNumberOfSimsAndPets(true, out numSimMembers, out numPetMembers);
            int        numForBirth = GetNumForBirth(alien, pregoRandom, numSimMembers, numPetMembers);
            Random     gen         = new Random(mRandomGenSeed);
            List <Sim> list        = new List <Sim>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription babyDescription = AlienUtilsEx.MakeAlienBaby(alien, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, interactive);
                mMom.Household.Add(babyDescription);
                Sim baby = babyDescription.Instantiate(Vector3.Empty);
                baby.SetPosition(mMom.Position);

                if (homeBirth)
                {
                    TotallyHideBaby(baby);
                }

                list.Add(baby);
                CheckForGhostBaby(baby);

                if (baby.SimDescription.IsPlayableGhost)
                {
                    EventTracker.SendEvent(EventTypeId.kHadGhostBaby, mMom, baby);
                }

                if (i == 0)
                {
                    EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBaby, baby.SimDescription));
                }

                MidlifeCrisisManager.OnHadChild(mMom.SimDescription);
                EventTracker.SendEvent(EventTypeId.kNewOffspring, mMom, baby);
                //EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mMom);

                if (mDad != null)
                {
                    EventTracker.SendEvent(EventTypeId.kNewOffspring, mDad, baby);
                    EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mDad);
                }

                EventTracker.SendEvent(EventTypeId.kChildBornOrAdopted, null, baby);
            }

            if (miniAlien != null)
            {
                alien.Household.Destroy();
                alien.Household.RemoveTemporary(alien);
                alien.Dispose(true, true);
            }

            if (mMom.Household != null)
            {
                mMom.Household.InvalidateThumbnail();
            }

            switch (numForBirth)
            {
            case 1:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabySingle, mMom.SimDescription));
                break;

            case 2:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTwins, mMom.SimDescription));
                break;

            case 3:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTriplets, mMom.SimDescription));
                break;
            }

            return(list);
        }