Kaynağa Gözat

修复眩晕击落飞不起来问题

LAPTOP-OM1V99U2\永远de小亡灵 10 ay önce
ebeveyn
işleme
a8084846cc
1 değiştirilmiş dosya ile 6 ekleme ve 5 silme
  1. 6 5
      ActionTowerDefense/Assets/Scripts/Enemy.cs

+ 6 - 5
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -523,6 +523,11 @@ public class Enemy : MoveCharacter
                     {
                         if (upFirstAfterWeaknessOrNot)
                         {
+                            if (canFly)
+                            {
+                                rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
+                                rb.useGravity = false;
+                            }
                             if (AdjustHeight())
                             {
                                 ChangeState(CharacterState.Idle);
@@ -730,11 +735,7 @@ public class Enemy : MoveCharacter
                 break;
             case CharacterState.Weak:
                 beRepelValue = totalBeRepelValue;
-                if (canFly)
-                {
-                    rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ |RigidbodyConstraints.FreezePositionY;
-                    rb.useGravity = false;
-                }
+
                 if (isBeBlownUp)
                 {
                     isBeBlownUp = false;