public Animal(Gender gender, int generation, int age) { RealName = AnimalHelper.GetNewAnimalName(); Gender = gender; Generation = generation; Age = age; IsPregnant = false; }
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; }
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)); } }
public bool IsReadyToMating() { return(AnimalHelper.IsReadyMating(this)); }