コード例 #1
0
ファイル: WalkingBrain.cs プロジェクト: Shivam338/AI-Projects
    public void Init()
    {
        // 0 Forward
        // 1 Back
        // 2 Left
        // 3 Right
        // 4 Crouch

        // Here its going to generate a no. from 0-3
        // This no. will make the Bot move accordingly
        Walkingdna = new WalkingDNA(DNAlength, 5);
        Bot        = GetComponent <ThirdPersonCharacter>();
        LifeSpan   = 0;
        StartPos   = transform.position;
        Alive      = true;
    }
コード例 #2
0
 public void OffSpringGen(WalkingDNA Parent1, WalkingDNA Parent2)
 {
     for (int i = 0; i < DNALength; i++)
     {
         // OffSprings is made in such a way that, it has half of its genes from Parent1 and the other half from the Parent2
         if (i < (DNALength / 2.0f))
         {
             int c = Parent1.genes[i];
             genes[i] = c;
         }
         else
         {
             int c = Parent2.genes[i];
             genes[i] = c;
         }
     }
 }