コード例 #1
0
 static protected bool Fight(UnitAgent attacker, UnitAgent defender)
 {
     if (attacker.team == defender.team)
     {
         attacker.AddReward(-0.05f);
         return(false);
     }
     else if (attacker.attack >= defender.attack && attacker.attack > 0)
     {
         defender.SetReward(-.1f);
         defender.Dead();
         defender.Done();
         attacker.SetReward(1f);
         attacker.Done();
         Debug.Log("Attacker Beat Defender");
         return(true);
     }
     else
     {
         attacker.SetReward(-.1f);
         attacker.Dead();
         attacker.Done();
         Debug.Log("Defender Beat Attacker");
         return(false);
     }
 }