示例#1
0
    public void ChangePrimaryState(AbstractState newState)
    {
        if (_currentState != null)
        {
            _currentState.OnStateExit();
        }

        _currentState = newState;

        var stateMachine = this;

        _currentState.OnStateEnter(ref stateMachine);

        OnStateChanged?.Invoke(_currentState.GetType());
    }