public IEnumerator RunCoroutine(IRoutineRunner runner)
        {
            Result    = new ObjectRoutineResult();
            IsRunning = true;

            do
            {
                if (runner.Stopped)
                {
                    break;
                }
                if (runner.Paused)
                {
                    while (runner.Paused)
                    {
                        yield return(null);
                    }
                }
                else
                {
                    action.Invoke();
                    yield return(yieldInstruction);
                }
            } while (loopCondition.Invoke());
            if (resultFunction != null)
            {
                Result = resultFunction.Invoke();
            }
            else
            {
                Result = new EmptyRoutineResult();
            }
            IsRunning = false;
        }
 public IEnumerator RunCoroutine(IRoutineRunner runner)
 {
     IsRunning = true;
     for (int i = 0; i < performTimes; i++)
     {
         if (runner.Stopped)
         {
             break;
         }
         if (runner.Paused)
         {
             while (runner.Paused)
             {
                 yield return(null);
             }
         }
         action.Invoke();
         yield return(yieldInstruction);
     }
     if (resultFunction != null)
     {
         Result = resultFunction.Invoke();
     }
     else
     {
         Result = new EmptyRoutineResult();
     }
     IsRunning = false;
 }
Пример #3
0
        public void addEnemyView(EnemyView enemyView, IRoutineRunner routineRunner)
        {
            EnemyColliderModel colliderModel = new EnemyColliderModel(enemyView, this);

            if (colliderModel != null && !_list.ContainsKey(colliderModel.name))
            {
                colliderModel.routineRunner = routineRunner;
                colliderModel.setState(CharacterStates.MOVE);
                _list.Add(colliderModel.name, colliderModel);
            }
            else
            {
                Debug.LogWarning("EnemyManager.addEnemyView. An element with the same key = " + colliderModel.name + " already exists in the dictionary!");
            }
        }
Пример #4
0
        public IEnumerator RunCoroutine(IRoutineRunner runner)
        {
            IsRunning = true;

            for (int i = 0; i < 1; i++)
            {
                if (runner.Stopped)
                {
                    break;
                }
                if (runner.Paused)
                {
                    while (runner.Paused)
                    {
                        yield return(null);
                    }
                }
                yield return(request.SendWebRequest());
            }
            Result.Success = true;
            IsRunning      = false;
        }