internal void _HandleException(CoroutineException e) { if (_pCurrentInstruction != null) { _pCurrentInstruction.Stop(); _pCurrentInstruction.DecRef(); _pCurrentInstruction = null; } _pCoroutineFunc = null; _state = CoroutineState.Stopped; if (_onException != null) { _onException(this, e); } else { if (_Parent != null) { /// 'Throw up' to parent _Parent._HandleException(e); } else { CoroutineMgr._ThrowException(e); } } if (_onStopped != null) { _onStopped(this); _Parent = null; } }
static public void Init() { if (_Instance == null) { _Instance = new CoroutineMgr(); _Instance._init(); } else { Debugger.LogWarning("CoroutineMgr.Init() be called more than once!!!"); } }
protected CoroutineMgr() { Debugger.Assert(_Instance == null, "Only one instance can be created for CoroutineMgr!!!"); _Instance = this; _CoEnterLogStack = new Stack <Coroutine>(); }
public Coroutine(CoroutineMgr pCoroutineMgr, IEnumerator pCoroutineFunc = null) { _pCoroutineMgr = pCoroutineMgr; _state = CoroutineState.Stopped; _AutoKill = true; }