TheKingsRace/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/MovementState/MoveStateManager.cs
Melbyj1125 6f0b3a0d0b Debug Scripts have been cleaned up.
I won't apply this cleanup to the networked version yet because they
will be updated to a state machine anyways.
2022-02-10 21:37:19 -06:00

39 lines
984 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveStateManager : MonoBehaviour
{
MoveBaseState currentState;
MoveIdleState IdleState = new MoveIdleState();
MoveWalkState WalkState = new MoveWalkState();
MoveJogState JogState = new MoveJogState();
MoveRunState RunState = new MoveRunState();
// Start is called before the first frame update
void Start()
{
//players starting state
currentState = IdleState;
currentState.EnterState(this);
}
// Update is called once per frame
void Update()
{
//calls any logic in the update state from current state
currentState.UpdateState(this);
}
void FixedUpdate(){
//calls any logic in the fixed update state from current state
currentState.FixedUpdateState(this);
}
void SwitchState(MoveBaseState state){
currentState = state;
state.EnterState(this);
}
}