public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback)
 {
     if (enemies == null)
     {
         Utils.Logger.GetInstance().Error("enemies is null");
         onOverCallback();
         return;
     }
     SquadUnitController[] units = enemies.GetAllUnits();
     if (units == null || units.Length <= 0)
     {
         Utils.Logger.GetInstance().Error("Failed to get enemy units");
         onOverCallback();
         return;
     }
     AttackAnimation.DoAnimation(units[0].transform.parent.position, () =>
     {
         foreach (SquadUnitController unit in units)
         {
             if (unit.Damagable != null)
             {
                 unit.Damagable.ReceiveDamage(strength);
             }
         }
     }, () =>
     {
         onOverCallback();
     });
 }
            public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback)
            {
                if (enemies == null)
                {
                    Utils.Logger.GetInstance().Error("enemies is null");
                    onOverCallback();
                    return;
                }
                SquadUnitController[] distancelineEnemies = enemies.GetDistanceLineUnits();
                if (distancelineEnemies == null || distancelineEnemies.Length <= 0)
                {
                    Utils.Logger.GetInstance().Message("failed to get distanceline enemies");
                    onOverCallback();
                    return;
                }
                SquadUnitController enemy = distancelineEnemies[Randomizer.Range(0, distancelineEnemies.Length)];

                if (enemy == null || enemy.Damagable == null)
                {
                    onOverCallback();
                    return;
                }
                AttackAnimation.DoAnimation(enemy.transform.position, () =>
                {
                    enemy.Damagable.ReceiveDamage(strength);
                }, () =>
                {
                    onOverCallback();
                });
            }
Exemple #3
0
 public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback)
 {
     if (teammates == null)
     {
         Utils.Logger.GetInstance().Error("teammates is null");
         onOverCallback();
         return;
     }
     SquadUnitController[] teammatesArray = teammates.GetAllUnits();
     if (teammatesArray == null || teammatesArray.Length <= 0)
     {
         Utils.Logger.GetInstance().Message("failed to get teammates");
         onOverCallback();
         return;
     }
     AttackAnimation.DoAnimation(teammatesArray[0].transform.parent.position, () =>
     {
         foreach (SquadUnitController teammate in teammatesArray)
         {
             if (teammate.Healable != null)
             {
                 teammate.Healable.ReceiveHeal(strength);
             }
         }
     }, () =>
     {
         onOverCallback();
     });
 }