Parcourir la source

取消rush时可以改方向

wulifu il y a 1 an
Parent
commit
eda80eb9c7
1 fichiers modifiés avec 49 ajouts et 41 suppressions
  1. 49 41
      ActionTowerDefense/Assets/Scripts/PlayerController.cs

+ 49 - 41
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -834,21 +834,21 @@ public class PlayerController : MoveCharacter
                     }
                 }
                 CachedPlayerInput();
-                if (leftDir.magnitude < 0.3f)
-                {
-                    if (bodyTrans.localScale.x > 0)
-                    {
-                        rushDir = Vector3.left;
-                    }
-                    else
-                    {
-                        rushDir = Vector3.right;
-                    }
-                }
-                else
-                {
-                    rushDir = leftDir.normalized;
-                }
+                //if (leftDir.magnitude < 0.3f)
+                //{
+                //    if (bodyTrans.localScale.x > 0)
+                //    {
+                //        rushDir = Vector3.left;
+                //    }
+                //    else
+                //    {
+                //        rushDir = Vector3.right;
+                //    }
+                //}
+                //else
+                //{
+                //    rushDir = leftDir.normalized;
+                //}
                 rb.velocity = rushDir * rushSpeed;
                 break;
             case CharacterState.Sprint:
@@ -869,22 +869,22 @@ public class PlayerController : MoveCharacter
                 mp -= sprintCostMp * Time.deltaTime;
                 uiMp.Show(mp, totalMp);
                 CachedPlayerInput();
-                CheckTurn();
-                if (leftDir.magnitude < 0.3f)
-                {
-                    if (bodyTrans.localScale.x > 0)
-                    {
-                        rushDir = Vector3.left;
-                    }
-                    else
-                    {
-                        rushDir = Vector3.right;
-                    }
-                }
-                else
-                {
-                    rushDir = leftDir.normalized;
-                }
+                //CheckTurn();
+                //if (leftDir.magnitude < 0.3f)
+                //{
+                //    if (bodyTrans.localScale.x > 0)
+                //    {
+                //        rushDir = Vector3.left;
+                //    }
+                //    else
+                //    {
+                //        rushDir = Vector3.right;
+                //    }
+                //}
+                //else
+                //{
+                //    rushDir = leftDir.normalized;
+                //}
                 rb.velocity = rushDir * rushSpeed;
                 break;
             case CharacterState.Die:
@@ -1041,20 +1041,28 @@ public class PlayerController : MoveCharacter
                 ani.Play("rush_loop", 0, 0);
                 rushTime = totalRushTime;
                 invincibleTime = rushInvincibleTime;
-                if (leftDir.magnitude < 0.3f)
+                //if (leftDir.magnitude < 0.3f)
+                //{
+                //    if (bodyTrans.localScale.x > 0)
+                //    {
+                //        rushDir = Vector3.left;
+                //    }
+                //    else
+                //    {
+                //        rushDir = Vector3.right;
+                //    }
+                //}
+                //else
+                //{
+                //    rushDir = leftDir.normalized;
+                //}
+                if (bodyTrans.localScale.x > 0)
                 {
-                    if (bodyTrans.localScale.x > 0)
-                    {
-                        rushDir = Vector3.left;
-                    }
-                    else
-                    {
-                        rushDir = Vector3.right;
-                    }
+                    rushDir = Vector3.left;
                 }
                 else
                 {
-                    rushDir = leftDir.normalized;
+                    rushDir = Vector3.right;
                 }
                 velocity = rushDir * rushSpeed;
                 mp -= rushCostMp;