示例#1
0
 public Entry(object target, IEnumerator enumerator, EnumeratorCoroutineProcessor coroutineProcessor, Action <object, Exception> handlerError)
 {
     _isUnityObject     = target is Object;
     _targetReference   = new WeakReference(target);
     Enumerator         = enumerator;
     CoroutineProcessor = coroutineProcessor;
     HandlerError       = handlerError;
 }
示例#2
0
        protected virtual ICoroutineProcessor CoroutineProcessorFactory(object current, int loopCount)
        {
            ICoroutineProcessor res = null;

            if (current is CoroutineSystemWaitForSeconds)
            {
                float a = loopCount > 0 ? _timeProvider.deltaTime : 0f;
                res = new WaitForSecondsCoroutineProcessor(_timeProvider, (( CoroutineSystemWaitForSeconds )current).Seconds + a);
            }
            else if (current is CustomYieldInstruction)
            {
                res = new UnityCustomYieldCoroutineProcessor(( CustomYieldInstruction )current);
            }
            else if (current is IEnumerator)
            {
                res = new EnumeratorCoroutineProcessor(_timeProvider, ( IEnumerator )current);
            }
            else if (current is AsyncOperation)
            {
                res = new AsyncOperationProcessor(( AsyncOperation )current);
            }
            else if (current is WaitForSeconds)
            {
                throw new UnityYieldInstructionNotSupportedException(( YieldInstruction )current, typeof(CoroutineSystemWaitForSeconds));
            }
            else if (current is YieldInstruction)
            {
                throw new UnityYieldInstructionNotSupportedException(( YieldInstruction )current);
            }
            else if (current is ICoroutineProcessor)
            {
                throw new UsingCoroutineProcessorInYieldingException();
            }

            return(res);
        }