Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
 static internal void _ThrowException(CoroutineException exception)
 {
     if (OnUnhandledException != null)
     {
         OnUnhandledException(exception);
     }
     else
     {
         throw exception;
     }
 }