Browse Source

cook本人不会被咬)

SZAND\msx_2 1 year ago
parent
commit
3b37557011
1 changed files with 15 additions and 12 deletions
  1. 15 12
      ActionTowerDefense/Assets/Scripts/Spirits/Spirits_Cook.cs

+ 15 - 12
ActionTowerDefense/Assets/Scripts/Spirits/Spirits_Cook.cs

@@ -47,20 +47,23 @@ public class Spirits_Cook : MonoBehaviour
     {
         if (!once && other.gameObject.layer == 7 || other.gameObject.layer == 8 || other.gameObject.layer == 6)
         {
-            GameObject ga = other.transform.parent.parent.parent.gameObject;
-            Character ca = ga.GetComponent<Character>();
-            if (Array.IndexOf(customers, ga) == -1)
+            if (chuan > 0)
             {
-                chuan -= 1;
-                text.text = chuan.ToString();
-                ani.Play("attack_march", 0, 0);
-                ca.HpUp(value, larger);
-                customers[count] = ga;
-                count += 1;
-                Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
-                if (chuan == 0)
+                GameObject ga = other.transform.parent.parent.parent.gameObject;
+                Character ca = ga.GetComponent<Character>();
+                if (Array.IndexOf(customers, ga) == -1)
                 {
-                    goAway = true;
+                    chuan -= 1;
+                    text.text = chuan.ToString();
+                    ani.Play("attack_march", 0, 0);
+                    ca.HpUp(value, larger);
+                    customers[count] = ga;
+                    count += 1;
+                    Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
+                    if (chuan <= 0)
+                    {
+                        goAway = true;
+                    }
                 }
             }
             /*×ܹ²ÄÃÒ»´®