Kaynağa Gözat

修改单体攻击的索敌bug

SZAND\msx_2 7 ay önce
ebeveyn
işleme
2d3bf47d5c

+ 9 - 15
ActionTowerDefense/Assets/Scripts/AttackTrigger.cs

@@ -39,21 +39,6 @@ public class AttackTrigger : MonoBehaviour
             photosphere.Reflex(owner.beHitTrigger, damage);
             return;
         }
-
-        if (isSingleAttack)
-        {
-            if (trigedObjs.Count != 0)
-            {
-                if (!trigedObjs[0].owner.isDie)
-                {
-                    return;
-                }
-                else
-                {
-                    trigedObjs.Clear();
-                }
-            }
-        }
         BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
         if (hitTrigger != null)
         {
@@ -79,6 +64,7 @@ public class AttackTrigger : MonoBehaviour
     }
     private void OnDisable()
     {
+        int attackTimeLimit = 1;
         if (isInVain)
         {
             isInVain = false;
@@ -89,6 +75,10 @@ public class AttackTrigger : MonoBehaviour
             {
                 if (trigedObjs[i] && Util.CheckCanHit(owner.tag, trigedObjs[i].owner.tag) && !trigedObjs[i].owner.isDie)
                 {
+                    if (isSingleAttack && attackTimeLimit == 0)
+                    {
+                        break;
+                    }
                     if (onlyFlyCanWeak && !trigedObjs[i].owner.canFly)
                     {
                         MoveCharacter moveCharacter = trigedObjs[i].owner.GetComponent<MoveCharacter>();
@@ -119,6 +109,10 @@ public class AttackTrigger : MonoBehaviour
                     {
                         trigedObjs[i].attackerID = owner.GetComponent<Demonic>().id;
                     }
+                    if (isSingleAttack)
+                    {
+                        attackTimeLimit--;
+                    }
                 }
             }
         }