فهرست منبع

多手柄接入,左摇杆控制左右和跳跃,LB冲刺

LAPTOP-OM1V99U2\永远de小亡灵 1 سال پیش
والد
کامیت
569093d4b1

+ 5 - 60
ActionTowerDefense/Assets/Resources/Actions/Player.inputactions

@@ -15,7 +15,7 @@
                     "initialStateCheck": true
                 },
                 {
-                    "name": "Jump",
+                    "name": "Sprinting",
                     "type": "Button",
                     "id": "65436323-1ca7-42e1-b650-6fd09d23b27e",
                     "expectedControlType": "Button",
@@ -91,80 +91,25 @@
                     "isComposite": false,
                     "isPartOfComposite": true
                 },
-                {
-                    "name": "wasd",
-                    "id": "b3b3d422-154e-4520-a886-69a8b0a011ca",
-                    "path": "2DVector",
-                    "interactions": "",
-                    "processors": "",
-                    "groups": "",
-                    "action": "Move",
-                    "isComposite": true,
-                    "isPartOfComposite": false
-                },
-                {
-                    "name": "up",
-                    "id": "3df5309c-c4a2-4036-bbc4-60ee6365b4a9",
-                    "path": "<Keyboard>/upArrow",
-                    "interactions": "",
-                    "processors": "",
-                    "groups": "",
-                    "action": "Move",
-                    "isComposite": false,
-                    "isPartOfComposite": true
-                },
-                {
-                    "name": "down",
-                    "id": "711884ae-242d-4bf8-b50a-bc818811b5ac",
-                    "path": "<Keyboard>/downArrow",
-                    "interactions": "",
-                    "processors": "",
-                    "groups": "",
-                    "action": "Move",
-                    "isComposite": false,
-                    "isPartOfComposite": true
-                },
-                {
-                    "name": "left",
-                    "id": "fe4948c1-75c8-4337-87fb-22f7e9bcbaf3",
-                    "path": "<Keyboard>/leftArrow",
-                    "interactions": "",
-                    "processors": "",
-                    "groups": "",
-                    "action": "Move",
-                    "isComposite": false,
-                    "isPartOfComposite": true
-                },
-                {
-                    "name": "right",
-                    "id": "9d1d16cf-6216-4063-804f-8bb7f769a578",
-                    "path": "<Keyboard>/rightArrow",
-                    "interactions": "",
-                    "processors": "",
-                    "groups": "",
-                    "action": "Move",
-                    "isComposite": false,
-                    "isPartOfComposite": true
-                },
                 {
                     "name": "",
                     "id": "585c861e-3a14-40ec-8402-b3ba16525930",
-                    "path": "<Gamepad>/buttonSouth",
+                    "path": "<Gamepad>/leftShoulder",
                     "interactions": "",
                     "processors": "",
                     "groups": "",
-                    "action": "Jump",
+                    "action": "Sprinting",
                     "isComposite": false,
                     "isPartOfComposite": false
                 },
                 {
                     "name": "",
                     "id": "eded0a7d-f8a9-4c84-aa39-1a3790f71f70",
-                    "path": "<Keyboard>/space",
+                    "path": "<Keyboard>/leftShift",
                     "interactions": "",
                     "processors": "",
                     "groups": "",
-                    "action": "Jump",
+                    "action": "Sprinting",
                     "isComposite": false,
                     "isPartOfComposite": false
                 }

+ 33 - 1
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -720,6 +720,7 @@ GameObject:
   - component: {fileID: 3571941038519084349}
   - component: {fileID: 3571941038519084336}
   - component: {fileID: 3571941038519084339}
+  - component: {fileID: 7794839579855634582}
   m_Layer: 6
   m_Name: Player
   m_TagString: Player
@@ -840,6 +841,7 @@ MonoBehaviour:
   uiMp: {fileID: 8465211090008398057}
   playerRope: {fileID: 0}
   eventTrigger: {fileID: 8878694457807976444}
+  sprintLinkTrigger: {fileID: 2536450432252384432}
   jumpSpeed: 20
   airJumpSpeed: 17
   rushSpeed: 54
@@ -848,6 +850,7 @@ MonoBehaviour:
   mpReplySpeed: 12
   rushCostMp: 20
   sprintCostMp: 10
+  corpses: 0
   rushInvincibleTime: 0.2
   canJumpTime: 0
   leaveGroundCanJumpTime: 0.15
@@ -870,7 +873,6 @@ MonoBehaviour:
   attackState: 0
   attackMoveSpeed: 5
   rushDir: {x: 0, y: 0, z: 0}
-  sprintLinkTrigger: {fileID: 2536450432252384432}
   isClickBtnJump: 0
   isClickBtnRush: 0
   isKeepBtnRush: 0
@@ -895,6 +897,36 @@ Rigidbody:
   m_Interpolate: 0
   m_Constraints: 120
   m_CollisionDetection: 0
+--- !u!114 &7794839579855634582
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3571941038519084344}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Actions: {fileID: -944628639613478452, guid: 05ba1aced13f16c44bfd7bee55a43f3d, type: 3}
+  m_NotificationBehavior: 0
+  m_UIInputModule: {fileID: 0}
+  m_DeviceLostEvent:
+    m_PersistentCalls:
+      m_Calls: []
+  m_DeviceRegainedEvent:
+    m_PersistentCalls:
+      m_Calls: []
+  m_ControlsChangedEvent:
+    m_PersistentCalls:
+      m_Calls: []
+  m_ActionEvents: []
+  m_NeverAutoSwitchControlSchemes: 0
+  m_DefaultControlScheme: 
+  m_DefaultActionMap: PlayerMap
+  m_SplitScreenIndex: -1
+  m_Camera: {fileID: 0}
 --- !u!1 &3571941039716665622
 GameObject:
   m_ObjectHideFlags: 0

+ 56 - 98
ActionTowerDefense/Assets/Scenes/SampleScene.unity

@@ -301,7 +301,7 @@ Transform:
   m_Children:
   - {fileID: 514997753}
   m_Father: {fileID: 0}
-  m_RootOrder: 9
+  m_RootOrder: 8
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!54 &317380085
 Rigidbody:
@@ -343,6 +343,7 @@ GameObject:
   - component: {fileID: 494178956}
   - component: {fileID: 494178955}
   - component: {fileID: 494178954}
+  - component: {fileID: 494178957}
   m_Layer: 0
   m_Name: EventSystem
   m_TagString: Untagged
@@ -357,7 +358,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 494178953}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
   m_Name: 
@@ -398,8 +399,52 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 0}
-  m_RootOrder: 3
+  m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &494178957
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 494178953}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 621567455fd1c4ceb811cc8a00b6a1a5, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_NotificationBehavior: 0
+  m_MaxPlayerCount: -1
+  m_AllowJoining: 1
+  m_JoinBehavior: 0
+  m_PlayerJoinedEvent:
+    m_PersistentCalls:
+      m_Calls: []
+  m_PlayerLeftEvent:
+    m_PersistentCalls:
+      m_Calls: []
+  m_JoinAction:
+    m_UseReference: 0
+    m_Action:
+      m_Name: 
+      m_Type: 0
+      m_ExpectedControlType: 
+      m_Id: 
+      m_Processors: 
+      m_Interactions: 
+      m_SingletonActionBindings: []
+      m_Flags: 0
+    m_Reference: {fileID: 0}
+  m_PlayerPrefab: {fileID: 3571941038519084344, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
+  m_SplitScreen: 0
+  m_MaintainAspectRatioInSplitScreen: 0
+  m_FixedNumberOfSplitScreens: -1
+  m_SplitScreenRect:
+    serializedVersion: 2
+    x: 0
+    y: 0
+    width: 1
+    height: 1
 --- !u!1 &514997752
 GameObject:
   m_ObjectHideFlags: 0
@@ -575,28 +620,17 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 519420028}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 584ea0f557c97344f9b229261554243d, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  player: {fileID: 540821988}
+  player: {fileID: 0}
   offsetX: 6
   offsetY: 3
   offsetZ: -16
   lerpValue: 3.5
   targetPos: {x: 0, y: 0, z: 0}
---- !u!114 &540821988 stripped
-MonoBehaviour:
-  m_CorrespondingSourceObject: {fileID: 3571941038519084336, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-  m_PrefabInstance: {fileID: 3571941039474348810}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 0}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 0b46e3a90d8fc304caef18f1c373478c, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!1 &585662580
 GameObject:
   m_ObjectHideFlags: 0
@@ -632,7 +666,7 @@ Transform:
   - {fileID: 2111188094}
   - {fileID: 2045679345}
   m_Father: {fileID: 0}
-  m_RootOrder: 2
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &1360535226
 GameObject:
@@ -740,7 +774,7 @@ PrefabInstance:
     m_Modifications:
     - target: {fileID: 6364039941502603542, guid: 2f24cd9614ae27e4e9525c04d7c7244f, type: 3}
       propertyPath: m_RootOrder
-      value: 8
+      value: 7
       objectReference: {fileID: 0}
     - target: {fileID: 6364039941502603542, guid: 2f24cd9614ae27e4e9525c04d7c7244f, type: 3}
       propertyPath: m_LocalPosition.x
@@ -792,17 +826,6 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 2f24cd9614ae27e4e9525c04d7c7244f, type: 3}
---- !u!114 &1366036431 stripped
-MonoBehaviour:
-  m_CorrespondingSourceObject: {fileID: 112529840073562573, guid: 2f24cd9614ae27e4e9525c04d7c7244f, type: 3}
-  m_PrefabInstance: {fileID: 1366036430}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 0}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 105a87ba6cf66a240911fe4f462ca6c8, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!1 &1500161231
 GameObject:
   m_ObjectHideFlags: 0
@@ -1041,7 +1064,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 0}
-  m_RootOrder: 4
+  m_RootOrder: 3
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &1714821087
 MonoBehaviour:
@@ -1287,7 +1310,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: 7247696002149726, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
       propertyPath: m_RootOrder
-      value: 5
+      value: 4
       objectReference: {fileID: 0}
     - target: {fileID: 7247696002149726, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
       propertyPath: m_LocalPosition.x
@@ -1635,71 +1658,6 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
---- !u!1001 &3571941039474348810
-PrefabInstance:
-  m_ObjectHideFlags: 0
-  serializedVersion: 2
-  m_Modification:
-    m_TransformParent: {fileID: 0}
-    m_Modifications:
-    - target: {fileID: 3571941038519084336, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: playerRope
-      value: 
-      objectReference: {fileID: 1366036431}
-    - target: {fileID: 3571941038519084344, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_Name
-      value: Player
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_RootOrder
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalPosition.x
-      value: 130.8
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalPosition.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalPosition.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalRotation.x
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalRotation.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalRotation.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.x
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3571941038519084349, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8031175604109220779, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
-      propertyPath: m_Mesh
-      value: 
-      objectReference: {fileID: 0}
-    m_RemovedComponents: []
-  m_SourcePrefab: {fileID: 100100000, guid: 5b538f610930dd743a096c582e2810f4, type: 3}
 --- !u!1001 &3581793010024254886
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -1709,7 +1667,7 @@ PrefabInstance:
     m_Modifications:
     - target: {fileID: 3581793008941702769, guid: 9b26b01efd8ba674a98444c19a0af89e, type: 3}
       propertyPath: m_RootOrder
-      value: 6
+      value: 5
       objectReference: {fileID: 0}
     - target: {fileID: 3581793008941702769, guid: 9b26b01efd8ba674a98444c19a0af89e, type: 3}
       propertyPath: m_LocalPosition.x
@@ -1770,7 +1728,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: 6126647545658003342, guid: 27fc9f9c5a91ca44395c454662e9576a, type: 3}
       propertyPath: m_RootOrder
-      value: 7
+      value: 6
       objectReference: {fileID: 0}
     - target: {fileID: 6126647545658003342, guid: 27fc9f9c5a91ca44395c454662e9576a, type: 3}
       propertyPath: m_LocalPosition.x

+ 4 - 4
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -20,7 +20,7 @@ public class Demonic : MoveCharacter
 
     private void OnDisable()
     {
-        PlayerController.instance.OnDemonicRecycle(this);
+        PlayersInput.instance[0].OnDemonicRecycle(this);
     }
 
     public override void FixedUpdate()
@@ -426,8 +426,8 @@ public class Demonic : MoveCharacter
                 dieKeepTime = totalDieKeepTime;
                 //接尸体存入动效
                 //友方死亡后计入尸体
-                PlayerController.instance.corpses++;
-                print(PlayerController.instance.corpses);
+                PlayersInput.instance[0].corpses++;
+                //print(PlayersInput.instance[0].corpses);
                 break;
             case CharacterState.Weak:
                 aniCollider.Play("Weak", 0, 0);
@@ -446,7 +446,7 @@ public class Demonic : MoveCharacter
     {
         base.Attack1();
         Vector3 moveDir;
-        if (PlayerController.instance.bodyTrans.localScale.x > 0)
+        if (PlayersInput.instance[0].bodyTrans.localScale.x > 0)
         {
             moveDir = Vector3.left;
         }

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -371,8 +371,8 @@ public class Enemy : MoveCharacter
                 DropSouls();
                 if (linked)
                 {
-                    PlayerController.instance.sprintLinkTrigger.linkedEnemy.Remove(this);
-                    PlayerController.instance.playerRope.gameObject.SetActive(false);
+                    PlayersInput.instance[0].sprintLinkTrigger.linkedEnemy.Remove(this);
+                    PlayersInput.instance[0].playerRope.gameObject.SetActive(false);
                 }
                 break;
             case CharacterState.Weak:

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

@@ -11,6 +11,7 @@ using System;
 using Base.Common;
 using cfg;
 using static UnityEngine.EventSystems.EventTrigger;
+using UnityEngine.InputSystem;
 
 [Serializable]
 public struct AttackInfo
@@ -31,7 +32,7 @@ public enum PlayerAttackState
 
 public class PlayerController : MoveCharacter
 {
-    public static PlayerController instance;
+    //public static PlayerController instance;
 
     public List<GameObject> demonicPrefabs;
     public List<Vector3> demonicSummonPos;
@@ -93,7 +94,8 @@ public class PlayerController : MoveCharacter
     {
         get
         {
-            return Input.GetKeyDown(KeyCode.Space) || isClickBtnJump;
+            //return Input.GetKeyDown(KeyCode.Space) || isClickBtnJump;
+            return leftDir.y>0.5f || isClickBtnJump;
         }
     }
     [HideInInspector]
@@ -102,7 +104,8 @@ public class PlayerController : MoveCharacter
     {
         get
         {
-            return Input.GetKeyDown(KeyCode.LeftShift) || isClickBtnRush;
+            //return Input.GetKeyDown(KeyCode.LeftShift) || isClickBtnRush;
+            return isClickBtnRush;
         }
     }
     [HideInInspector]
@@ -111,7 +114,8 @@ public class PlayerController : MoveCharacter
     {
         get
         {
-            return Input.GetKey(KeyCode.LeftShift) || isKeepBtnRush;
+            //return Input.GetKey(KeyCode.LeftShift) || isKeepBtnRush;
+            return isKeepBtnRush;
         }
     }
     [HideInInspector]
@@ -161,32 +165,32 @@ public class PlayerController : MoveCharacter
     }
     [HideInInspector]
     public bool isKeepBtnNorth;
-
-    public Vector2 leftDir
-    {
-        get
-        {
-            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);
-        }
-    }
+    public Vector2 leftDir;
+    //public Vector2 leftDir
+    //{
+    //    get
+    //    {
+    //        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);
+    //    }
+    //}
 
     public override void Init()
     {
@@ -197,15 +201,15 @@ public class PlayerController : MoveCharacter
 
     private void Awake()
     {
-        if (!instance)
+        if (!PlayersInput.instance[0])
         {
-            instance = this;
-        }
-        else
-        {
-            DestroyImmediate(gameObject);
-            return;
+            PlayersInput.instance[0] = this;
         }
+        //else
+        //{
+        //    DestroyImmediate(gameObject);
+        //    return;
+        //}
         demonicDic = new Dictionary<int, List<Demonic>>();
         demonicId = new List<int>() { 0, 0, 0 };
         Init();
@@ -213,18 +217,19 @@ public class PlayerController : MoveCharacter
 
     private void Update()
     {
-        if (Input.GetKeyDown(KeyCode.LeftShift))
-        {
-            isClickBtnRush = true;
-        }
-        if (Input.GetKey(KeyCode.LeftShift))
-        {
-            isKeepBtnRush = true;
-        }
-        if (Input.GetKeyDown(KeyCode.Space))
-        {
-            isClickBtnJump = true;
-        }
+        //if (Input.GetKeyDown(KeyCode.LeftShift))
+        //{
+        //    isClickBtnRush = true;
+        //}
+        //if (Input.GetKey(KeyCode.LeftShift))
+        //{
+        //    isKeepBtnRush = true;
+        //}
+        //if (Input.GetKeyDown(KeyCode.Space))
+        //{
+        //    isClickBtnJump = true;
+        //}
+
         if (Input.GetKeyDown(KeyCode.J))
         {
             isClickBtnWest = true;
@@ -242,7 +247,25 @@ public class PlayerController : MoveCharacter
             isClickBtnNorth = true;
         }
     }
+    //手柄按下LB
+    void OnSprinting()
+    {
+        if (!isKeepBtnRush)
+        {
+            isClickBtnRush = true;
+        }
+        isKeepBtnRush = true;
+    }
 
+    //读取手柄左摇杆参数
+    private void OnMove(InputValue value)
+    {
+        leftDir = value.Get<Vector2>();
+        if (leftDir.y > 0.5f)
+        {
+            isClickBtnJump = true;
+        }
+    }
     public void Jump()
     {
         SetUpSpeed(jumpSpeed);

+ 0 - 8
ActionTowerDefense/Assets/Scripts/PlayerInput.cs

@@ -1,8 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public static class PlayerInput
-{
-    public static int instance;
-}

+ 1 - 1
ActionTowerDefense/Assets/Scripts/PlayerRope.cs

@@ -22,7 +22,7 @@ public class PlayerRope : MonoBehaviour
             gameObject.SetActive(false);
             return;
         }
-        line.SetPosition(0, PlayerController.instance.transform.position + Vector3.up);
+        line.SetPosition(0, PlayersInput.instance[0].transform.position + Vector3.up);
         line.SetPosition(1, targetEnemy.transform.position + Vector3.up);
     }
 

+ 8 - 0
ActionTowerDefense/Assets/Scripts/PlayersInput.cs

@@ -0,0 +1,8 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PlayersInput
+{
+    static public PlayerController[] instance = new PlayerController[2];
+}

+ 1 - 1
ActionTowerDefense/Assets/Scripts/PlayerInput.cs.meta → ActionTowerDefense/Assets/Scripts/PlayersInput.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5ed00f9e30e5dbc4c9e6ffd11cf9c75c
+guid: 65660487888229240b2c9d257248a710
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Rivet.cs

@@ -27,7 +27,7 @@ public class Rivet : Character
             CharacterRope rope = ropeObj.GetComponent<CharacterRope>();
             rope.BeLink(enemies[i], this);
         }
-        PlayerController.instance.sprintLinkTrigger.linkedEnemyDic.Clear();
-        PlayerController.instance.sprintLinkTrigger.linkedEnemy.Clear();
+        PlayersInput.instance[0].sprintLinkTrigger.linkedEnemyDic.Clear();
+        PlayersInput.instance[0].sprintLinkTrigger.linkedEnemy.Clear();
     }
 }

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Soul.cs

@@ -26,7 +26,7 @@ public class Soul : MonoBehaviour
         rb.isKinematic = true;
         collected = true;
         tweenPos.from = transform;
-        tweenPos.to = PlayerController.instance.transform;
+        tweenPos.to = PlayersInput.instance[0].transform;
         tweenPos.duration = (tweenPos.from.position - tweenPos.to.position).magnitude / flySpeed;
         tweenPos.ResetToBeginning();
         tweenPos.PlayForward();
@@ -37,7 +37,7 @@ public class Soul : MonoBehaviour
 
     public void BeGet()
     {
-        PlayerController.instance.mp += addMp;
+        PlayersInput.instance[0].mp += addMp;
     }
 
     private void FixedUpdate()

+ 1 - 1
ActionTowerDefense/Assets/Scripts/SprintLinkTrigger.cs

@@ -45,6 +45,6 @@ public class SprintLinkTrigger : MonoBehaviour
     {
         linkedEnemyDic.Add(enemy, true);
         linkedEnemy.Add(enemy);
-        PlayerController.instance.playerRope.BeLink(enemy);
+        PlayersInput.instance[0].playerRope.BeLink(enemy);
     }
 }