19 lines
431 B (Stored with Git LFS)
C#
19 lines
431 B (Stored with Git LFS)
C#
namespace DDD
|
|
{
|
|
public class PlayerStateMachine
|
|
{
|
|
private IStateMachine _currentStateMachine;
|
|
|
|
public void ChangeState(IStateMachine newStateMachine)
|
|
{
|
|
_currentStateMachine?.Exit();
|
|
_currentStateMachine = newStateMachine;
|
|
_currentStateMachine.Enter();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
_currentStateMachine?.Update();
|
|
}
|
|
}
|
|
} |