예제 #1
0
 public Animal(Gender gender, int generation, int age)
 {
     RealName   = AnimalHelper.GetNewAnimalName();
     Gender     = gender;
     Generation = generation;
     Age        = age;
     IsPregnant = false;
 }
예제 #2
0
        public CoopManager(CoopSettingsDto coopSettings, AnimalHelper animalHelper)
        {
            var AncestorMaleAnimal   = new Animal(Gender.Male, 1, coopSettings.InitialAgeForStartup);
            var AncestorFemaleAnimal = new Animal(Gender.Female, 1, coopSettings.InitialAgeForStartup);

            AnimalList.Add(AncestorMaleAnimal);
            AnimalList.Add(AncestorFemaleAnimal);
            CoopSettings = coopSettings;
            AnimalHelper = animalHelper;
        }
예제 #3
0
        public void TryBorn(out IList <Animal> childs)
        {
            childs = new List <Animal>();
            var childCount    = AnimalHelper.GetCountOfChildForBorn();
            var newGeneration = this.Generation + 1;

            foreach (int value in Enumerable.Range(1, childCount))
            {
                var gender = AnimalHelper.GetGenderOfBabe();
                childs.Add(new Animal(gender, newGeneration));
            }
        }
예제 #4
0
 public bool IsReadyToMating()
 {
     return(AnimalHelper.IsReadyMating(this));
 }