コード例 #1
0
ファイル: Unit.cs プロジェクト: ruocheng411/MagicMotion
 public void Cast(Unit target, SpecialAttack specialAttack)
 {
     if (!isBusy() && specialAttack.IsUsableNow(target, this))
     {
         state = State.Casting;
         currentSpecialAttack = specialAttack;
         specialAttack.PreAttackAction(target, this);
         castTimer  = specialAttack.attackPeriod;
         castTarget = target;
     }
 }
コード例 #2
0
ファイル: Unit.cs プロジェクト: supercontact/MagicMotion
 /// <summary>
 /// Directly performs a given special attack towards the target (does not check if target is in attack range, but checks the IsUsableNow condition of the special attack).
 /// </summary>
 public void Cast(Unit target, SpecialAttack specialAttack)
 {
     specialAttack.target   = target;
     specialAttack.attacker = this;
     if (!isBusy() && castTimer <= 0 && specialAttack.IsUsableNow())
     {
         state = State.Casting;
         currentSpecialAttack = specialAttack;
         specialAttack.PreAttackAction();
         castTimer  = specialAttack.lasting ? specialAttack.attackDelay : specialAttack.attackPeriod;
         castTarget = target;
         cast       = false;
     }
 }