mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-23 10:14:27 -05:00
I won't apply this cleanup to the networked version yet because they will be updated to a state machine anyways.
39 lines
984 B
C#
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);
|
|
}
|
|
}
|