Implemented Crouch walking

This commit is contained in:
Melbyj1125
2022-04-08 15:21:24 -05:00
parent 562b64b160
commit fdc77ada48
9 changed files with 135 additions and 63 deletions

View File

@@ -11,7 +11,7 @@ public class MoveCrouchState : MoveBaseState
public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){
//if not coming from slide state then rotate player and adjust height
if(previousState != mSM.SlideState){
if(previousState != mSM.SlideState && previousState != mSM.CrouchWalkState){
mSM.pStats.CurVel = 0;
mSM.moveController.height *= .5f;
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y - mSM.moveController.height * .5f,0);
@@ -45,7 +45,9 @@ public class MoveCrouchState : MoveBaseState
Debug.Log(slideRay.collider.name);
}
}
else if((Input.GetAxis("Vertical") > 0.0f || Input.GetAxis("Horizontal") > 0.0f)){
mSM.SwitchState(mSM.CrouchWalkState);
}
//Debug.DrawRay(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up * 2f, Color.red);
@@ -58,8 +60,6 @@ public class MoveCrouchState : MoveBaseState
public override void FixedUpdateState(MoveStateManager mSM){
mSM.transform.Rotate(Vector3.up * -mSM.sensitivity * Time.deltaTime * Input.GetAxis("Mouse X"));
mSM.SlideMovement();
mSM.CrouchMovement();
}
}