Code/k/StateMachine.cs
using Sandbox.k.Interfaces;

namespace Sandbox.k
{
    public class StateMachine : IStateMachine<IState>
    {
        private IState _currentState;

        public bool ChangeState(IState newState)
        {
            _currentState?.Exit();

            _currentState = newState;
            _currentState.Enter();
            
            return true;
        }

        public bool Refresh()
        {
            _currentState?.Execute();
            return true;
        }
    }
}