Ejemplo n.º 1
0
 private void UpdatePregnancy()
 {
     if (IsPregnant && World.Time.CurrentDate > CurrentPregnancy.EndDate)
     {
         if (!_speciesCounts.ContainsKey(Species) || _speciesCounts[Species] < _maxPerSpecies)
         {
             if (EntityFactory.HasEntity(BabyType))
             {
                 var baby = EntityFactory.CreateEntity <GameComponent>(BabyType, Physics.Position);
                 baby.GetRoot().GetComponent <CreatureAI>().PositionConstraint = AI.PositionConstraint;
             }
         }
         CurrentPregnancy = null;
     }
 }
Ejemplo n.º 2
0
 private void UpdatePregnancy()
 {
     if (IsPregnant && World.Time.CurrentDate > CurrentPregnancy.EndDate)
     {
         // Todo: This check really belongs before the creature becomes pregnant.
         if (World.GetSpeciesPopulation(Stats.CurrentClass) < Stats.Species.SpeciesLimit)
         {
             if (EntityFactory.HasEntity(Stats.Species.BabyType))
             {
                 var baby = EntityFactory.CreateEntity <GameComponent>(Stats.Species.BabyType, Physics.Position);
                 baby.GetRoot().GetComponent <CreatureAI>().PositionConstraint = AI.PositionConstraint;
             }
         }
         CurrentPregnancy = null;
     }
 }
Ejemplo n.º 3
0
        private void UpdatePregnancy()
        {
            if (IsPregnant && World.Time.CurrentDate > CurrentPregnancy.EndDate)
            {
                // Todo: This check really belongs before the creature becomes pregnant.
                if (World.CanSpawnWithoutExceedingSpeciesLimit(Stats.Species))
                {
                    if (EntityFactory.HasEntity(Stats.Species.BabyType))
                    {
                        var baby = EntityFactory.CreateEntity <GameComponent>(Stats.Species.BabyType, Physics.Position);

                        if (baby.GetRoot().GetComponent <CreatureAI>().HasValue(out var ai)) // Set position constraint so baby stays inside pen.
                        {
                            ai.PositionConstraint = AI.PositionConstraint;
                        }
                    }
                }
                CurrentPregnancy = null;
            }
        }