mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-31 06:44:33 -05:00
Have a lot of the basic movement in the stateMachine
Will need to finish up and implement some of the ragdoll interactions
This commit is contained in:
@@ -5,15 +5,24 @@ using UnityEngine;
|
||||
public class MoveIdleState : MoveBaseState
|
||||
{
|
||||
public override void EnterState(MoveStateManager mSM){
|
||||
|
||||
Debug.Log("Idle State");
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
|
||||
//Move to Walk State after speed increases
|
||||
if(mSM.calculatedCurVel >= mSM.idleLimit){
|
||||
mSM.SwitchState(mSM.WalkState);
|
||||
}
|
||||
|
||||
//If Q or joystick button1 crouch state
|
||||
if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q))){
|
||||
mSM.SwitchState(mSM.CrouchState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
|
||||
mSM.DirectionalMovement();
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter(MoveStateManager mSM){
|
||||
|
||||
@@ -5,15 +5,29 @@ using UnityEngine;
|
||||
public class MoveJogState : MoveBaseState
|
||||
{
|
||||
public override void EnterState(MoveStateManager mSM){
|
||||
|
||||
Debug.Log("Jog State");
|
||||
//Debug.Log(mSM.calculatedCurVel);
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
|
||||
//move to run state if speed increases
|
||||
if(mSM.calculatedCurVel >= mSM.runLimit){
|
||||
mSM.SwitchState(mSM.RunState);
|
||||
}
|
||||
//move to walk if speed decreases
|
||||
else if(mSM.calculatedCurVel < mSM.walkLimit){
|
||||
mSM.SwitchState(mSM.WalkState);
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q))){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
|
||||
mSM.DirectionalMovement();
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter(MoveStateManager mSM){
|
||||
|
||||
@@ -5,15 +5,25 @@ using UnityEngine;
|
||||
public class MoveRunState : MoveBaseState
|
||||
{
|
||||
public override void EnterState(MoveStateManager mSM){
|
||||
|
||||
Debug.Log("Run State");
|
||||
//Debug.Log(mSM.calculatedCurVel);
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
|
||||
//move to Jog if speed decreases
|
||||
if(mSM.calculatedCurVel < mSM.runLimit){
|
||||
mSM.SwitchState(mSM.JogState);
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q))){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
|
||||
mSM.DirectionalMovement();
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter(MoveStateManager mSM){
|
||||
|
||||
@@ -5,15 +5,29 @@ using UnityEngine;
|
||||
public class MoveWalkState : MoveBaseState
|
||||
{
|
||||
public override void EnterState(MoveStateManager mSM){
|
||||
|
||||
Debug.Log("Walk State");
|
||||
//Debug.Log(mSM.calculatedCurVel);
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
|
||||
//move to Jog if speed increases
|
||||
if(mSM.calculatedCurVel >= mSM.jogLimit){
|
||||
mSM.SwitchState(mSM.JogState);
|
||||
}
|
||||
//move to Idle if speed decreases
|
||||
else if(mSM.calculatedCurVel < mSM.idleLimit){
|
||||
mSM.SwitchState(mSM.IdleState);
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q))){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
|
||||
mSM.DirectionalMovement();
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter(MoveStateManager mSM){
|
||||
|
||||
Reference in New Issue
Block a user