public void Start <TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { var wrapper = SmPool.Get <StateMachineWrapper <TStateMachine> >(); wrapper.StateMachine = stateMachine; _stateMachine = wrapper; wrapper.MoveNext(); }
public void SetException(Exception exception) { if (_stateMachine != null) { SmPool.Recycle(_stateMachine); } _stateMachine = null; CoroutineManagerBase.CurrentInstance.SetException(exception); }
public void SetResult(T result) { _result = result; IsCompleted = true; if (_stateMachine != null) { SmPool.Recycle(_stateMachine); } _stateMachine = null; }
public void Discard() { if (_isConstant) { return; } _result = default; IsCompleted = false; if (_stateMachine != null) { SmPool.Recycle(_stateMachine); } _stateMachine = null; Pool.Recycle(this); }