diff --git a/Assets/Bindings.SHConfig b/Assets/Bindings.SHConfig index bdc254b5..83bc14db 100644 --- a/Assets/Bindings.SHConfig +++ b/Assets/Bindings.SHConfig @@ -1,4 +1,4 @@ -7 +10 Controller Look Horizontal 0 0 @@ -23,6 +23,32 @@ Controller Look Vertical 1 19 0 +Drop +0 +0 +1000 +0.2 +1000 +0 +1 +2 +0 +1 +13 +0 +GrabThrow +0 +0 +1000 +0.2 +1000 +0 +1 +1 +0 +1 +11 +0 Horizontal 0 0 @@ -76,6 +102,19 @@ Mouse Look Vertical 0 0 0 +Sprint +0 +0 +1000 +0.2 +1000 +0 +1 +160 +0 +1 +6 +0 Vertical 0 0 diff --git a/Assets/Scenes/MainMenu.shade b/Assets/Scenes/MainMenu.shade index 197de206..1aceddad 100644 --- a/Assets/Scenes/MainMenu.shade +++ b/Assets/Scenes/MainMenu.shade @@ -297,6 +297,7 @@ Color: {x: 1, y: 1, z: 1, w: 1} Layer: 4294967295 Strength: 0 + Casting Shadows: false IsActive: true Scripts: ~ - EID: 3 diff --git a/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs b/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs index 87ef2b85..27e3906c 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs @@ -79,7 +79,7 @@ public class PickAndThrow : Script itemRidigBody.LinearVelocity = Vector3.Zero; itemRidigBody.AngularVelocity = Vector3.Zero; - if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton)) + if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton) || Input.GetBindingPositiveButtonDown("GrabThrow")) { pc.isAiming = true; pc.camArm.ArmLength = aimingLength; @@ -88,7 +88,7 @@ public class PickAndThrow : Script pc.cam.FOV = aimingFOV; } - if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) + if ((Input.GetMouseButtonUp(Input.MouseCode.LeftButton) || Input.GetBindingPositiveButtonUp("GrabThrow")) && pc.isAiming) { AudioHandler.audioClipHandlers["SFXThrow"].Play(); itemRidigBody.IsGravityEnabled = true; @@ -104,7 +104,7 @@ public class PickAndThrow : Script timer = 0.0f; } - if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && !pc.isAiming) + if ((Input.GetMouseButtonDown(Input.MouseCode.RightButton) || Input.GetBindingPositiveButtonDown("Drop")) && !pc.isAiming) { pc.holdItem = false; inRange = false; @@ -113,7 +113,7 @@ public class PickAndThrow : Script ResetItemObject(); } - if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming) + if ((Input.GetMouseButtonDown(Input.MouseCode.RightButton) || Input.GetBindingPositiveButtonDown("Drop")) && pc.isAiming) { pc.isAiming = false; pc.cam.FOV = defaultFOV; @@ -130,7 +130,7 @@ public class PickAndThrow : Script } } - if (timer > delayTimer && pc && !pc.holdItem && inRange && Input.GetMouseButtonDown(Input.MouseCode.LeftButton)) + if (timer > delayTimer && pc && !pc.holdItem && inRange && (Input.GetMouseButtonDown(Input.MouseCode.LeftButton) || Input.GetBindingPositiveButtonDown("GrabThrow"))) { if (pc.currentState == RaccoonStates.WALKING || pc.currentState == RaccoonStates.IDLE) { diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index 4e2f38ec..0c4dd7bc 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -202,42 +202,54 @@ public class PlayerController : Script private void MoveKey() { axisMove = Vector2.Zero; - if (Input.GetKey(Input.KeyCode.W)) + if (Input.GetKey(Input.KeyCode.W) || Input.GetBindingAxisRaw("Vertical") > 0.0f) { Vector3 camerAixs = cam.GetForward(); camerAixs.y = 0; camerAixs.Normalise(); - axisMove += new Vector2(camerAixs.x, camerAixs.z); + Vector2 forwardMove = new Vector2(camerAixs.x, camerAixs.z); + forwardMove *= Input.GetBindingAxis("Vertical"); + //axisMove += new Vector2(camerAixs.x, camerAixs.z); + axisMove += forwardMove; } - if (Input.GetKey(Input.KeyCode.S)) + if (Input.GetKey(Input.KeyCode.S) || Input.GetBindingAxisRaw("Vertical") < 0.0f) { Vector3 camerAixs = cam.GetForward(); camerAixs.y = 0; camerAixs.Normalise(); - axisMove -= new Vector2(camerAixs.x, camerAixs.z); + Vector2 forwardMove = new Vector2(camerAixs.x, camerAixs.z); + forwardMove *= Input.GetBindingAxis("Vertical"); + //axisMove -= new Vector2(camerAixs.x, camerAixs.z); + axisMove += forwardMove; } - if (Input.GetKey(Input.KeyCode.A)) + if (Input.GetKey(Input.KeyCode.A) || Input.GetBindingAxisRaw("Horizontal") < 0.0f) { Vector3 camerAixs = cam.GetRight(); camerAixs.y = 0; camerAixs.Normalise(); - axisMove -= new Vector2(camerAixs.x, camerAixs.z); + Vector2 sideMove = new Vector2(camerAixs.x, camerAixs.z); + sideMove *= Input.GetBindingAxis("Horizontal"); + //axisMove -= new Vector2(camerAixs.x, camerAixs.z); + axisMove += sideMove; } - if (Input.GetKey(Input.KeyCode.D)) + if (Input.GetKey(Input.KeyCode.D) || Input.GetBindingAxisRaw("Horizontal") > 0.0f) { Vector3 camerAixs = cam.GetRight(); camerAixs.y = 0; camerAixs.Normalise(); - axisMove += new Vector2(camerAixs.x, camerAixs.z); + Vector2 sideMove = new Vector2(camerAixs.x, camerAixs.z); + sideMove *= Input.GetBindingAxis("Horizontal"); + //axisMove += new Vector2(camerAixs.x, camerAixs.z); + axisMove += sideMove; } - axisMove.Normalise(); + //axisMove.Normalise(); isMoveKeyPress = axisMove.x != 0 || axisMove.y != 0; - if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift)) + if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift) && Input.GetBindingAxisRaw("Sprint") == 0.0f) { currentState = RaccoonStates.WALKING; @@ -276,7 +288,7 @@ public class PlayerController : Script private void Sprint() { - if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded) + if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded && Input.GetBindingAxisRaw("Sprint") > 0.0f) { currentState = RaccoonStates.RUNNING; if (stateMachine && !stateMachine.IsState(typeof(PlayerRunState))) @@ -294,7 +306,7 @@ public class PlayerController : Script } } - if (Input.GetKeyUp(Input.KeyCode.LeftShift)) + if (Input.GetKeyUp(Input.KeyCode.LeftShift) || Input.GetBindingPositiveButtonUp("Sprint")) { if (isMoveKeyPress) { @@ -312,7 +324,7 @@ public class PlayerController : Script { if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE) { - if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null) + if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad || Input.GetBindingPositiveButtonDown("Jump")) && isGrounded && rb != null) { currentState = RaccoonStates.JUMP; Vector3 v = rb.LinearVelocity; @@ -337,7 +349,7 @@ public class PlayerController : Script } } - if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space))) + if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space) || Input.GetBindingPositiveButtonUp("Jump"))) currentState = RaccoonStates.FALLING; } diff --git a/Assets/Scripts/Gameplay/Player/SC_ThirdPersonCamera.cs b/Assets/Scripts/Gameplay/Player/SC_ThirdPersonCamera.cs index 6e4e1f7b..5af81c5e 100644 --- a/Assets/Scripts/Gameplay/Player/SC_ThirdPersonCamera.cs +++ b/Assets/Scripts/Gameplay/Player/SC_ThirdPersonCamera.cs @@ -49,7 +49,15 @@ namespace SHADE_Scripting CameraArm arm = GetComponent(); if (arm) { - Vector2 vel = Input.GetMouseVelocity(); + Vector2 vel = new Vector2(); + if (!Input.ControllerInUse) + vel = Input.GetMouseVelocity(); + else + { + //TODO REPLACE HARDCODED MULTIPLIER + vel.x = (float)Input.GetBindingAxis("Controller Look Horizontal") * 300.0f; + vel.y = (float)Input.GetBindingAxis("Controller Look Vertical") * 300.0f; + } if(inverseYControls) arm.Pitch -= vel.y * turnSpeedPitch * Time.DeltaTimeF; else diff --git a/Assets/Scripts/UI/SC_MainMenu.cs b/Assets/Scripts/UI/SC_MainMenu.cs index 8252344d..56e712b1 100644 --- a/Assets/Scripts/UI/SC_MainMenu.cs +++ b/Assets/Scripts/UI/SC_MainMenu.cs @@ -12,6 +12,9 @@ public class MainMenu : Script protected override void awake() { + //Load the bindings + Input.LoadBindings(); + AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu"); AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element"); AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");