From 3ff60a830aa9ff21904c5bd947ade4d470b41fcc Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Wed, 16 Feb 2022 00:18:44 -0600 Subject: [PATCH] bug with crouch fixed --- .../DebugStateStuff/MovementState/Slide/MoveCrouchState.cs | 6 ------ .../DebugStateStuff/MovementState/Slide/MoveSlideState.cs | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveCrouchState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveCrouchState.cs index dfb255b..b6774c2 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveCrouchState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveCrouchState.cs @@ -6,7 +6,6 @@ public class MoveCrouchState : MoveBaseState { //Slide Variables - float originalTraction; // Traction before slide started RaycastHit slideRay; // slide raycast public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){ @@ -15,10 +14,8 @@ public class MoveCrouchState : MoveBaseState if(previousState != mSM.SlideState){ //Initialize Important Stats On state enter mSM.pStats.CurVel = 0; - originalTraction = mSM.pStats.Traction; mSM.gameObject.transform.eulerAngles = new Vector3(mSM.transform.localEulerAngles.x - 90, mSM.transform.localEulerAngles.y, mSM.transform.localEulerAngles.z); mSM.moveController.height *= .5f; - mSM.pStats.Traction = 0.01f; } } @@ -26,7 +23,6 @@ public class MoveCrouchState : MoveBaseState if(nextState != mSM.CrouchWalkState){ mSM.gameObject.transform.localEulerAngles = new Vector3(0, 0, 0); mSM.pStats.CurVel = mSM.calculatedCurVel; - mSM.pStats.Traction = originalTraction; mSM.moveController.height *= 2.0f; } @@ -38,7 +34,6 @@ public class MoveCrouchState : MoveBaseState public override void FixedUpdateState(MoveStateManager mSM){ mSM.transform.Rotate(Vector3.forward * -mSM.sensitivity * Time.deltaTime * Input.GetAxis("Mouse X")); - mSM.pStats.Traction += .004f; ///////ONCE WE HAVE IT SO SLIDE DOESNT ROTATE PLAYER MOVE THIS TO UPDATE //If player isn't pressing either Q or the joystick button they stop crouching if nothing is above them @@ -59,6 +54,5 @@ public class MoveCrouchState : MoveBaseState mSM.SwitchState(mSM.IdleState); } */ - mSM.SlideMovement(); } } diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveSlideState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveSlideState.cs index 721cdd2..9301773 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveSlideState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/Slide/MoveSlideState.cs @@ -26,6 +26,9 @@ public class MoveSlideState : MoveBaseState mSM.pStats.Traction = originalTraction; mSM.moveController.height *= 2.0f; } + else{ + mSM.pStats.Traction = originalTraction; + } } public override void UpdateState(MoveStateManager mSM){