public void Init()
 {
     //Initialize dna
     //0 foward
     //1 turn left
     //2 turn right
     DNACapsule = new DNACapsule(DNALength, 3);
     timeAlive  = 0;
     alive      = true;
     Character  = Instantiate(CharacterPrefab, this.transform.position, this.transform.rotation);
     Character.GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>().target = this.transform;
 }
Example #2
0
 public void Combine(DNACapsule parent1, DNACapsule parent2)
 {
     for (int i = 0; i < dnaLength; i++)
     {
         if (i < dnaLength / 2.0)
         {
             int c = parent1.genes[i];
             genes[i] = c;
         }
         else
         {
             int c = parent2.genes[i];
             genes[i] = c;
         }
     }
 }