Browse Source

玩家卡住问题debug按钮

1243896040 2 weeks ago
parent
commit
6b12657ec5
1 changed files with 48 additions and 5 deletions
  1. 48 5
      ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

+ 48 - 5
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -17,6 +17,7 @@ public class PlayerController : MoveCharacter
 {
     [Space(30)]
     [Title("PlayerController属性")]
+    public bool isDebug;
     public int playerId;
     [LabelText("主角刷新位置")] public Vector2 refreshPos;
     public bool canJump;
@@ -70,9 +71,8 @@ public class PlayerController : MoveCharacter
     [Tooltip("场上每多一个同种类兵种,召唤兵种蓝耗+x")] public float[] addCostMp;
 
     [Header("移动属性")]
-    public Vector2 moveVec;         //玩家不动时移动数据
-    [HideInInspector]
-    public Vector2 leftDir;
+    [DisplayOnly] public Vector2 moveVec;         //玩家不动时移动数据
+    [DisplayOnly] public Vector2 leftDir;
 
     //
     [FoldoutGroup("冲刺属性", order: -1)] public float rushSpeed = 100;
@@ -652,6 +652,10 @@ public class PlayerController : MoveCharacter
                     summonTime = 0;
                     cacheRush = false;
                     ChangeState(CharacterState.Rush);
+                    if (isDebug)
+                    {
+                        Debug.Log("玩家卡住问题查找return1");
+                    }
                     return true;
                 }
             }
@@ -662,6 +666,10 @@ public class PlayerController : MoveCharacter
             {
                 if (CheckSummon())
                 {
+                    if (isDebug)
+                    {
+                        Debug.Log("玩家卡住问题查找return2");
+                    }
                     return true;
                 }
             }
@@ -672,6 +680,10 @@ public class PlayerController : MoveCharacter
                 {
                     summonTime = 0;
                     ChangeState(CharacterState.Rise);
+                    if (isDebug)
+                    {
+                        Debug.Log("玩家卡住问题查找return3");
+                    }
                     return true;
                 }
             }
@@ -681,6 +693,10 @@ public class PlayerController : MoveCharacter
                 {
                     summonTime = 0;
                     ChangeState(CharacterState.Fall);
+                    if (isDebug)
+                    {
+                        Debug.Log("玩家卡住问题查找return4");
+                    }
                     return true;
                 }
             }
@@ -701,6 +717,10 @@ public class PlayerController : MoveCharacter
                         ani.Play("summon_air", 0, 0);
                     } 
                 }
+                if (isDebug)
+                {
+                    Debug.Log("玩家卡住问题查找return5");
+                }
                 return true;
             }
             if (btnJumpPress || cacheJumpTime > 0)
@@ -710,6 +730,10 @@ public class PlayerController : MoveCharacter
                     summonTime = 0;
                     Jump();
                     ChangeState(CharacterState.Rise);
+                    if (isDebug)
+                    {
+                        Debug.Log("玩家卡住问题查找return6");
+                    }
                     return true;
                 }
             }
@@ -738,6 +762,10 @@ public class PlayerController : MoveCharacter
                     {
                         summonTime = 0;
                         ChangeState(CharacterState.Run);
+                        if (isDebug)
+                        {
+                            Debug.Log("玩家卡住问题查找return7");
+                        }
                         return true;
                     }
                 }
@@ -746,6 +774,10 @@ public class PlayerController : MoveCharacter
                     if (excludeState != CharacterState.Idle && summonTime <= 0)
                     {
                         ChangeState(CharacterState.Idle);
+                        if (isDebug)
+                        {
+                            Debug.Log("玩家卡住问题查找return8");
+                        }
                         return true;
                     }
                 }
@@ -758,6 +790,10 @@ public class PlayerController : MoveCharacter
                     {
                         summonTime = 0;
                         ChangeState(CharacterState.Run);
+                        if (isDebug)
+                        {
+                            Debug.Log("玩家卡住问题查找return9");
+                        }
                         return true;
                     }
                 }
@@ -765,14 +801,21 @@ public class PlayerController : MoveCharacter
                 {
                     if (excludeState != CharacterState.Idle && summonTime <= 0)
                     {
-                        ChangeState(CharacterState.Idle);                        
+                        ChangeState(CharacterState.Idle);
+                        if (isDebug)
+                        {
+                            Debug.Log("玩家卡住问题查找return10");
+                        }
                         return true;
                     }
                 }
             }
             
         }
-
+        if (isDebug)
+        {
+            Debug.Log("玩家卡住问题查找return11");
+        }
         return false;
     }