diff --git a/Dust Bunny/Assets/Scripts/Input/Controls.inputactions b/Dust Bunny/Assets/Scripts/Input/Controls.inputactions index e0377cc1..68ec77ca 100644 --- a/Dust Bunny/Assets/Scripts/Input/Controls.inputactions +++ b/Dust Bunny/Assets/Scripts/Input/Controls.inputactions @@ -101,6 +101,28 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "0e4c3537-eb30-42ab-be80-f27b38511fa3", + "path": "/leftShoulder", + "interactions": "", + "processors": "", + "groups": "Gamepad", + "action": "Dash", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "555a5b97-552d-4ab2-87d1-f5f0ae28846a", + "path": "/leftTrigger", + "interactions": "", + "processors": "", + "groups": "", + "action": "Dash", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "746486e1-a73d-4df6-9a2b-fa1b0116bb1b", @@ -145,6 +167,28 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "43e99718-1812-4ef2-9347-7b867710d166", + "path": "/rightShoulder", + "interactions": "", + "processors": "", + "groups": "Gamepad", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "01b7bbe4-d3bf-4451-864e-5ae518f5762d", + "path": "/rightTrigger", + "interactions": "", + "processors": "", + "groups": "Gamepad", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "070a91a9-d912-47bc-8862-26793990d48d", diff --git a/Dust Bunny/Assets/Scripts/Player/PlayerAnimator.cs b/Dust Bunny/Assets/Scripts/Player/PlayerAnimator.cs index 1c23c4ab..bf6c99bc 100644 --- a/Dust Bunny/Assets/Scripts/Player/PlayerAnimator.cs +++ b/Dust Bunny/Assets/Scripts/Player/PlayerAnimator.cs @@ -168,6 +168,23 @@ private void HandleSquashAndStretch(){ //_sprite.transform.localScale = new Vector3(1, yScale, 1); } + private Vector2 GetDashArrowTargetByMoveInput(Vector2 moveInput){ + Vector2 dashTargetWorldPosition; + float dashLengthMod = 1 + (.8f * _player.Stats.DashDuration * _player.Stats.DashVelocity * transform.localScale.x); + if (moveInput.sqrMagnitude > 0.01f) + { + dashTargetWorldPosition = _arrowPivot.transform.position + (Vector3)(moveInput * dashLengthMod); + } + else + { + float mod = 1; + if (_sprite.flipX) mod = -1; + dashTargetWorldPosition = _arrowPivot.transform.position + new Vector3(mod * dashLengthMod, 0, 0); + } + + return dashTargetWorldPosition; + } + private void HandleDashArrow() { float cameraZoom = Camera.main.orthographicSize; @@ -176,23 +193,19 @@ private void HandleDashArrow() Vector3 dashTargetWorldPosition; if (UserInput.instance.UseMouseForDash) { - dashTargetWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); - dashTargetWorldPosition.z = 0; + FrameInput _frameInput = UserInput.instance.Gather(); + if(_frameInput.DashDirectionGamepad.magnitude < 0.01f){ + dashTargetWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); + dashTargetWorldPosition.z = 0; + } else { + Vector2 moveInput = _frameInput.DashDirectionGamepad; + dashTargetWorldPosition = GetDashArrowTargetByMoveInput(moveInput); + } } else { Vector2 moveInput = dashTargetWorldPosition = UserInput.instance.Gather().Move; - float dashLengthMod = 1 + (.8f * _player.Stats.DashDuration * _player.Stats.DashVelocity * transform.localScale.x); - if (moveInput.sqrMagnitude > 0.001f) - { - dashTargetWorldPosition = _arrowPivot.transform.position + (Vector3)(moveInput * dashLengthMod); - } - else - { - float mod = 1; - if (_sprite.flipX) mod = -1; - dashTargetWorldPosition = _arrowPivot.transform.position + new Vector3(mod * dashLengthMod, 0, 0); - } + dashTargetWorldPosition = GetDashArrowTargetByMoveInput(moveInput); } // deep math i do not understand