Esempio n. 1
0
        public void Start <TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
        {
            var wrapper = SmPool.Get <StateMachineWrapper <TStateMachine> >();

            wrapper.StateMachine = stateMachine;

            _stateMachine = wrapper;

            wrapper.MoveNext();
        }
Esempio n. 2
0
        public void SetException(Exception exception)
        {
            if (_stateMachine != null)
            {
                SmPool.Recycle(_stateMachine);
            }

            _stateMachine = null;

            CoroutineManagerBase.CurrentInstance.SetException(exception);
        }
Esempio n. 3
0
        public void SetResult(T result)
        {
            _result     = result;
            IsCompleted = true;

            if (_stateMachine != null)
            {
                SmPool.Recycle(_stateMachine);
            }

            _stateMachine = null;
        }
Esempio n. 4
0
        public void Discard()
        {
            if (_isConstant)
            {
                return;
            }

            _result     = default;
            IsCompleted = false;

            if (_stateMachine != null)
            {
                SmPool.Recycle(_stateMachine);
            }

            _stateMachine = null;

            Pool.Recycle(this);
        }