瀏覽代碼

跳跃,召唤小兵

LAPTOP-OM1V99U2\永远de小亡灵 1 年之前
父節點
當前提交
dbec64fac0

+ 158 - 3
ActionTowerDefense/Assets/Resources/Actions/Player.inputactions

@@ -15,11 +15,56 @@
                     "initialStateCheck": true
                 },
                 {
-                    "name": "Sprinting",
+                    "name": "SprintingPress",
                     "type": "Button",
                     "id": "65436323-1ca7-42e1-b650-6fd09d23b27e",
                     "expectedControlType": "Button",
                     "processors": "",
+                    "interactions": "Press",
+                    "initialStateCheck": false
+                },
+                {
+                    "name": "SprintingRelease",
+                    "type": "Button",
+                    "id": "a7588055-e97e-4c50-8f34-b2e231726369",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "Press(behavior=1)",
+                    "initialStateCheck": false
+                },
+                {
+                    "name": "Jump",
+                    "type": "Button",
+                    "id": "44c139f2-28f4-4e47-a2ba-0950321fdf45",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "Press",
+                    "initialStateCheck": false
+                },
+                {
+                    "name": "Summon0",
+                    "type": "Button",
+                    "id": "c78488ea-8db8-4878-ab49-a3ff46050237",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "",
+                    "initialStateCheck": false
+                },
+                {
+                    "name": "Summon1",
+                    "type": "Button",
+                    "id": "ee5e60d3-8180-4bbc-9d35-447308e598c3",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "",
+                    "initialStateCheck": false
+                },
+                {
+                    "name": "Summon2",
+                    "type": "Button",
+                    "id": "de75f7e9-eede-492d-b479-ba18180a981f",
+                    "expectedControlType": "Button",
+                    "processors": "",
                     "interactions": "",
                     "initialStateCheck": false
                 }
@@ -98,7 +143,7 @@
                     "interactions": "",
                     "processors": "",
                     "groups": "",
-                    "action": "Sprinting",
+                    "action": "SprintingPress",
                     "isComposite": false,
                     "isPartOfComposite": false
                 },
@@ -109,7 +154,117 @@
                     "interactions": "",
                     "processors": "",
                     "groups": "",
-                    "action": "Sprinting",
+                    "action": "SprintingPress",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "1fe4ef05-5320-4dd8-8f8b-4fd01d044d13",
+                    "path": "<Gamepad>/leftShoulder",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "SprintingRelease",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "977e9760-7e28-459a-a0e9-3fb3c21a7929",
+                    "path": "<Keyboard>/leftShift",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "SprintingRelease",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "2f6e261a-3366-4042-a123-62467b2bffad",
+                    "path": "<Keyboard>/space",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Jump",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "d88f089c-65c4-4ace-80ac-7755359a1068",
+                    "path": "<Gamepad>/buttonSouth",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Jump",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "a2b23a0b-9659-446c-8eec-bc8672be18f7",
+                    "path": "<Gamepad>/buttonWest",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon0",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "bfc90e5d-7235-4dc7-8794-201357bf22b5",
+                    "path": "<Keyboard>/j",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon0",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "ce014164-fae2-4ad2-a4dc-cb7fd383c45e",
+                    "path": "<Gamepad>/buttonNorth",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon1",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "82ba0f4c-2044-4bf1-a591-0ede0851a0df",
+                    "path": "<Keyboard>/k",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon1",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "8473c532-cedd-4aae-9119-c23dd74baaec",
+                    "path": "<Gamepad>/buttonEast",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon2",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "af06a536-37b7-4905-bee0-8cad63246dea",
+                    "path": "<Keyboard>/l",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon2",
                     "isComposite": false,
                     "isPartOfComposite": false
                 }

+ 43 - 15
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -95,7 +95,7 @@ public class PlayerController : MoveCharacter
         get
         {
             //return Input.GetKeyDown(KeyCode.Space) || isClickBtnJump;
-            return leftDir.y>0.5f || isClickBtnJump;
+            return  isClickBtnJump;
         }
     }
     [HideInInspector]
@@ -115,7 +115,7 @@ public class PlayerController : MoveCharacter
         get
         {
             //return Input.GetKey(KeyCode.LeftShift) || isKeepBtnRush;
-            return isKeepBtnRush;
+            return LBisHold || isKeepBtnRush;
         }
     }
     [HideInInspector]
@@ -171,6 +171,8 @@ public class PlayerController : MoveCharacter
     [HideInInspector]
     public bool isKeepBtnNorth;
     public Vector2 leftDir;
+
+
     //public Vector2 leftDir
     //{
     //    get
@@ -252,26 +254,51 @@ public class PlayerController : MoveCharacter
         //{
         //    isClickBtnNorth = true;
         //}
-    }
-    //手柄按下LB
-    void OnSprinting()
-    {
-        print("sprint");
-        if (!isKeepBtnRush)
+        if (LBisHold)
         {
-            isClickBtnRush = true;
+            isKeepBtnRush = true;
+        }
+
+        if (foot.TrigGround)
+        {
+            isUp = 0;
         }
-        isKeepBtnRush = true;
     }
+    
 
-    //读取手柄左摇杆参数
+    void OnSprintingPress()
+    {
+        LBisHold = true;
+        isClickBtnRush = true;
+        isKeepBtnRush = true;
+    }
+    void OnSprintingRelease()
+    {
+        LBisHold = false;
+    }
+    //手柄按下LB
+    public bool LBisHold;
+    //读取手柄参数
+    public int isUp; 
     private void OnMove(InputValue value)
     {
         leftDir = value.Get<Vector2>();
-        if (leftDir.y > 0.5f)
-        {
-            isClickBtnJump = true;
-        }
+    }
+    void OnJump()
+    {
+        isClickBtnJump = true;
+    }
+    void OnSummon0()
+    {
+        isClickBtnWest = true;
+    }
+    void OnSummon1()
+    {
+        isClickBtnSouth = true;
+    }
+    void OnSummon2()
+    {
+        isClickBtnEast = true;
     }
     public void Jump()
     {
@@ -281,6 +308,7 @@ public class PlayerController : MoveCharacter
 
     public void AirJump()
     {
+        print("airjump");
         SetUpSpeed(airJumpSpeed);
         ani.Play("jump", 0, 0);
     }