Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (activeCombat is null)
     {
         foreach (CombatUnit unit in units.Where(u => u != this && u.playerUnit != this.playerUnit))
         {
             //The odds of simaltionusly finding two units that are not already in combat should be so low I can ignote them.
             if (Vector3.Distance(this.transform.position, unit.transform.position) < engageRange)
             {
                 this.activeCombat = unit.EngageInCombat();
                 PlayParticles();
                 activeCombat.AddUnitToCombat(this);
             }
         }
     }
 }