15 lines
311 B
C#
15 lines
311 B
C#
using UnityEngine;
|
|
|
|
public class GameStateMachine : MonoBehaviour
|
|
{
|
|
public IState currentState;
|
|
|
|
public void ChangeState(IState nextState)
|
|
{
|
|
currentState?.exit();
|
|
currentState = nextState;
|
|
currentState.enter();
|
|
}
|
|
private void Update() => currentState?.update();
|
|
}
|