19 lines
380 B (Stored with Git LFS)
C#
19 lines
380 B (Stored with Git LFS)
C#
namespace DDD
|
|
{
|
|
public class PlayerStateMachine
|
|
{
|
|
private IPlayerState _currentState;
|
|
|
|
public void ChangeState(IPlayerState newState)
|
|
{
|
|
_currentState?.Exit();
|
|
_currentState = newState;
|
|
_currentState.Enter();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
_currentState?.Update();
|
|
}
|
|
}
|
|
} |