示例#1
0
        private void OnInterruptStateEnter(StateEnterArgs <TTrig, TName> triggerValue)
        {
            if (_action == null)
            {
                throw new NullReferenceException("Null state action");
            }

            _action.Invoke(triggerValue);
            _stateMachine.Restore(_resetState);
        }
示例#2
0
        private async Task OnAsyncInterruptStateEnter(StateEnterArgs <TTrig, TName> arg)
        {
            if (_asyncAction == null)
            {
                throw new NullReferenceException("Null state async action");
            }

            await _asyncAction.Invoke(arg);

            _stateMachine.Restore(_resetState);
        }
示例#3
0
        private void OnInterruptStateEnter(StateEnterArgs <TTrig, TName> triggerValue)
        {
            if (_action == null)
            {
                throw new NullReferenceException("Null state async action");
            }
            if (_stateMachine.PreviousState == null)
            {
                throw new Exception("Previous state cannot be null");
            }

            _action.Invoke(triggerValue);
            _stateMachine.Restore(_stateMachine.PreviousState);
        }
示例#4
0
        private void OnInterruptStateEnter(StateEnterArgs <TTrig, TName> triggerValue)
        {
            if (_action == null)
            {
                throw new NullReferenceException("Null state action");
            }
            if (_stateMachine.PreviousState == null)
            {
                throw new Exception("Previous state cannot be null");
            }

            _transitions.Remove(_returnTrig);
            AddTransition(_returnTrig, _stateMachine.PreviousState);
            _action.Invoke(triggerValue);
        }
示例#5
0
        private async Task OnAsyncInterruptStateEnter(StateEnterArgs <TTrig, TName> arg)
        {
            if (_asyncAction == null)
            {
                throw new NullReferenceException("Null state async action");
            }
            if (_stateMachine.PreviousState == null)
            {
                throw new Exception("Previous state cannot be null");
            }

            _transitions.Remove(_returnTrig);
            AddTransition(_returnTrig, _stateMachine.PreviousState);
            await _asyncAction.Invoke(arg);
        }
示例#6
0
 internal Task ActivateAsync(StateEnterArgs <TTrig, TName> value)
 {
     return(OnEnterAsync == null ? Task.CompletedTask : OnEnterAsync.Invoke(value));
 }
示例#7
0
 internal void Activate(StateEnterArgs <TTrig, TName> value)
 {
     OnEnter?.Invoke(value);
 }