diff --git a/Minecraft Client/Assets/Scripts/Game/Player.cs b/Minecraft Client/Assets/Scripts/Game/Player.cs index c6243ca..5a02ca8 100644 --- a/Minecraft Client/Assets/Scripts/Game/Player.cs +++ b/Minecraft Client/Assets/Scripts/Game/Player.cs @@ -29,6 +29,7 @@ public class Player : MonoBehaviour private Camera camera = null; private Vector3 lastPosition = new Vector3(); private Quaternion lastRotation = new Quaternion(); + private float lastTriggerL = 0, lastTriggerR = 0; //network @@ -92,13 +93,14 @@ public class Player : MonoBehaviour mouseX = Input.GetAxis("Mouse X"); mouseY = Input.GetAxis("Mouse Y"); + //Sprinting - if (Input.GetKeyDown(KeyCode.LeftShift)) + if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetButtonDown("Left Stick Button")) { walkSpeed = sprintSpeed; } - if (Input.GetKeyUp(KeyCode.LeftShift)) + if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetButtonUp("Left Stick Button")) { walkSpeed = defaultSpeed; } @@ -128,7 +130,7 @@ public class Player : MonoBehaviour transform.Rotate(0, mouseX * Time.timeScale, 0); //send destroy block request to server - if (Input.GetMouseButtonDown(0)) + if (Input.GetMouseButtonDown(0) || (Input.GetAxis("Right Trigger") > 0 && lastTriggerR == 0)) { if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit, 8)) { @@ -136,9 +138,11 @@ public class Player : MonoBehaviour client.EditBlock(hit.point, 0); } } + + lastTriggerR = Input.GetAxis("Right Trigger"); //send build block request to server - if (Input.GetMouseButtonDown(1)) + if (Input.GetMouseButtonDown(1) || (Input.GetAxis("Left Trigger") > 0 && lastTriggerL == 0)) { if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit, 8)) { @@ -147,6 +151,8 @@ public class Player : MonoBehaviour } } + lastTriggerL = Input.GetAxis("Left Trigger"); + if (transform.position.y < 0) { if(Time.timeScale > 0) diff --git a/Minecraft Client/ProjectSettings/InputManager.asset b/Minecraft Client/ProjectSettings/InputManager.asset index 17c8f53..f28496c 100644 --- a/Minecraft Client/ProjectSettings/InputManager.asset +++ b/Minecraft Client/ProjectSettings/InputManager.asset @@ -92,7 +92,7 @@ InputManager: negativeButton: positiveButton: space altNegativeButton: - altPositiveButton: + altPositiveButton: joystick button 0 gravity: 1000 dead: 0.001 sensitivity: 1000 @@ -234,7 +234,7 @@ InputManager: descriptiveName: descriptiveNegativeName: negativeButton: - positiveButton: joystick button 3 + positiveButton: joystick button 0 altNegativeButton: altPositiveButton: gravity: 1000 @@ -293,3 +293,83 @@ InputManager: type: 0 axis: 0 joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.3 + snap: 0 + invert: 0 + type: 2 + axis: 3 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.3 + snap: 0 + invert: 1 + type: 2 + axis: 4 + joyNum: 0 + - serializedVersion: 3 + m_Name: Right Trigger + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.3 + snap: 0 + invert: 0 + type: 2 + axis: 9 + joyNum: 0 + - serializedVersion: 3 + m_Name: Left Trigger + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.3 + snap: 0 + invert: 0 + type: 2 + axis: 8 + joyNum: 0 + - serializedVersion: 3 + m_Name: Left Stick Button + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 8 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 8 + joyNum: 0