コード例 #1
0
ファイル: CombatUnit.cs プロジェクト: smilewood/GMTKJam2020
 // 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);
             }
         }
     }
 }