示例#1
0
    protected virtual void Update()
    {
        var stateMachine = this;

        foreach (var state in _currentState.transitions)
        {
            if (state == _currentState)
            {
                continue;
            }

            if (state.IsStateReady(ref stateMachine) && _currentState.IsStateFinished())
            {
                ChangePrimaryState(state);
                break;
            }
        }

        if (_currentState != null)
        {
            _currentState.OnStateUpdate(ref stateMachine);
        }
    }