Beispiel #1
0
        public override void Perform(World world, RandomService randomService)
        {
            bool isFemale = true;

            for (int i = 0; i < Number; i++)
            {
                var randomStartPos  = randomService.GetNextInt(world, 0, randomService.Length);
                var randomIncrement = randomService.GetNextInt(world, 1, 1000);

                var person = new Person(randomStartPos, randomIncrement, Race, isFemale ? Gender.Female : Gender.Male, null, null, world.Date);
                person.Location = Location;
                world.LivingPeople.Add(person);
                isFemale = !isFemale;
            }
        }
Beispiel #2
0
        private bool ShouldBearYoung(GameTime date, Person person)
        {
            if (person.Gender != Gender.Female)
            {
                return(false);
            }

            if (!IsChildBearingAge(date, person))
            {
                return(false);
            }

            // TODO: Argh, these fertility chances need to know the partner's race. Should we separate chance of attempt from chance of success?
            return(RandomService.GetNextInt(person, 0, person.Race.FertilityChances[person.Race].Item1) == 0);
        }