public void Init() { // initialize dna //0 move foward //1 move left //2 move right dna = new DNA_bot(DNALength, 3); timeAlive = 0; alive = true; ethan = Instantiate(ethanPrefab, this.transform.position, this.transform.rotation); ethan.GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>().target = this.transform; }
public void Combine(DNA_bot d1, DNA_bot d2) { for (int i = 0; i < dnaLength; i++) { if (i < dnaLength / 2.0) { int c = d1.genes_bot[i]; genes_bot[i] = c; } else { int c = d2.genes_bot[i]; genes_bot[i] = c; } } }