Prechádzať zdrojové kódy

修复 左右方向键的快速点击输入会不响应,需要长按一小段时间才有反馈

wulifu 1 rok pred
rodič
commit
1c80aa1cc8

+ 1 - 1
ActionTowerDefense/Assets/Resources/Spine/king_devil/king_deil_Controller.controller

@@ -527,7 +527,7 @@ AnimationClip:
     m_Level: 0
     m_CycleOffset: 0
     m_HasAdditiveReferencePose: 0
-    m_LoopTime: 0
+    m_LoopTime: 1
     m_LoopBlend: 0
     m_LoopBlendOrientation: 0
     m_LoopBlendPositionY: 0

+ 19 - 1
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -132,7 +132,25 @@ public class PlayerController : MonoBehaviour
     {
         get
         {
-            return new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
+            int x = 0;
+            int y = 0;
+            if (Input.GetKey(KeyCode.A))
+            {
+                x--;
+            }
+            if (Input.GetKey(KeyCode.D))
+            {
+                x++;
+            }
+            if (Input.GetKey(KeyCode.S))
+            {
+                y--;
+            }
+            if (Input.GetKey(KeyCode.W))
+            {
+                y++;
+            }
+            return new Vector2(x, y);
         }
     }