Prechádzať zdrojové kódy

增加参数isBeBlownUp,当被击飞时为True

LAPTOP-OM1V99U2\永远de小亡灵 11 mesiacov pred
rodič
commit
985a4714c4
1 zmenil súbory, kde vykonal 10 pridanie a 1 odobranie
  1. 10 1
      ActionTowerDefense/Assets/Scripts/Enemy.cs

+ 10 - 1
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -38,6 +38,7 @@ public class Enemy : MoveCharacter
     public float jumpSpeed = 10;
     public float maxMoveSpeed, minMoveSpeed;
     public float runSpeed;
+    public bool isBeBlownUp;    //±»»÷·É
 
     [Header("µÐ·½Ó¢Áé")]
     public Spirits.SpiritType type;
@@ -454,6 +455,7 @@ public class Enemy : MoveCharacter
                 {
                     if(ani.GetCurrentAnimatorClipInfo(0)[0].clip.name != "hitted")
                     {
+                        isBeBlownUp = true;
                         ani.Play("hitted",0,0);
                         aniCollider.Play("Hurt",0,0);
                     }
@@ -474,6 +476,10 @@ public class Enemy : MoveCharacter
                 }
                 else
                 {
+                    if (isBeBlownUp)
+                    {
+                        isBeBlownUp = false;
+                    }
                     if (weakTime <= -0.1)
                     {
                         if (upFirstAfterWeaknessOrNot)
@@ -690,7 +696,10 @@ public class Enemy : MoveCharacter
                     rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ |RigidbodyConstraints.FreezePositionY;
                     rb.useGravity = false;
                 }
-                
+                if (isBeBlownUp)
+                {
+                    isBeBlownUp = false;
+                }
                 break;
             case CharacterState.Float:
                 canMove = true;