Exemple #1
0
 private YieldInstruction SafeMoveNext(CoroutinerExecutorBase coroutinerExecutorBase)
 {
     try
     {
         return(coroutinerExecutorBase.MoveNext());
     }
     catch (Exception e)
     {
         if (e is CoroutineException)
         {
             throw e;
         }
         throw new CoroutineException(e);
     }
 }
Exemple #2
0
 private bool CheckCurrent(ref YieldInstruction refYieldInstruction)
 {
     if (coroutine.Current != null)
     {
         YieldInstruction yieldInstruction = coroutine.Current as YieldInstruction;
         if (yieldInstruction != null)
         {
             if (lastInstruction != yieldInstruction)
             {
                 lastInstruction     = yieldInstruction;
                 refYieldInstruction = yieldInstruction;
                 return(true);
             }
         }
         else
         {
             if (inner == null || !inner.IsCreatedFrom(coroutine.Current))
             {
                 IEnumerator iEnumerator = coroutine.Current as IEnumerator;
                 IEnumerable iEnumerable = coroutine.Current as IEnumerable;
                 if (iEnumerator != null)
                 {
                     inner = new IEnumeratorExecutor(iEnumerator);
                 }
                 if (iEnumerable != null)
                 {
                     inner = new IEnumerableExecutor(iEnumerable);
                 }
                 if (inner == null)
                 {
                     Debug.LogError(coroutine.Current.GetType());
                 }
                 refYieldInstruction = SafeMoveNext(inner);
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #3
0
 protected void StartTestCoroutine(IEnumerator coroutine, string className, string methodName, Action onDone)
 {
     SetTestCoroutineParams(className, methodName, onDone);
     enumeratorExecutor = new IEnumeratorExecutor(coroutine);
 }