mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Implemented Crouch walking
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user