Quellcode durchsuchen

修复泰山压顶不眩晕问题

LAPTOP-OM1V99U2\永远de小亡灵 vor 11 Monaten
Ursprung
Commit
c99baa3fa9

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Conduct/Mountain.cs

@@ -28,9 +28,9 @@ public class Mountain : MonoBehaviour
             if (en.canFly)
             {
                 en.willBeFly = true;
-                en.canFly = false;
+                //en.canFly = false;
             }
-            en.ChangeState(CharacterState.Fall);
+            en.ChangeState(CharacterState.Weak);
             en.willBeComa = true;
             en.comaDamage = pc.swordNum * 100;
         }

+ 16 - 20
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -432,22 +432,22 @@ public class Enemy : MoveCharacter
                 }
                 Vector3 velocity = rb.velocity;
                 velocity.y += extraFallGravity * Time.deltaTime;
-                //if (leftDir.x > 0.3f)
-                //{
-                //    velocity.x = moveSpeed;
-                //    if (bodyTrans.localScale.x > 0)
-                //    {
-                //        Turn();
-                //    }
-                //}
-                //else if (leftDir.x < -0.3f)
-                //{
-                //    velocity.x = - moveSpeed;
-                //    if (bodyTrans.localScale.x < 0)
-                //    {
-                //        Turn();
-                //    }
-                //}
+                if (leftDir.x > 0.3f)
+                {
+                    velocity.x = moveSpeed;
+                    if (bodyTrans.localScale.x > 0)
+                    {
+                        Turn();
+                    }
+                }
+                else if (leftDir.x < -0.3f)
+                {
+                    velocity.x = -moveSpeed;
+                    if (bodyTrans.localScale.x < 0)
+                    {
+                        Turn();
+                    }
+                }
 
                 rb.velocity = velocity;
                 break;
@@ -709,8 +709,6 @@ public class Enemy : MoveCharacter
                 break;
             case CharacterState.Fall:
                 rb.velocity = Vector3.zero;
-                rb.useGravity = false;
-                rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ|RigidbodyConstraints.FreezePositionY;
                 break;
             //case CharacterState.Hurt:
             //    break;
@@ -818,8 +816,6 @@ public class Enemy : MoveCharacter
                 break;
             case CharacterState.Fall:
                 aniCollider.Play("Fall", 0, 0);
-                rb.useGravity = true;
-                rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
                 break;
             case CharacterState.Float:
                 canMove = false;