Exemple #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Creature" /> class.
 /// </summary>
 /// <param name="mommy">
 ///     The mommy.
 /// </param>
 /// <param name="daddy">
 ///     The daddy.
 /// </param>
 public Creature(Creature mommy, Creature daddy)
 {
     Debug.Assert(mommy.IdOfSpecies == daddy.IdOfSpecies, "Interspecies relation are FORBIDDEN!!!");
     this.mother = mommy;
     this.father = daddy;
     mommy.childs.Add(this);
     daddy.childs.Add(this);
     this.world       = mommy.world;
     this.IdOfSpecies = mommy.IdOfSpecies;
     for (var i = 0; i < this.genes.Length; i++)
     {
         this.genes[i] = EnumHelper.ChooseRandomGene(mommy.genes[i], daddy.genes[i]);
     }
 }