Ejemplo n.º 1
0
        public StaggeredMonoRunner(string name, int maxTasksPerFrame, bool mustSurvive = false)
        {
            _flushingOperation = new FlushingOperationStaggered(maxTasksPerFrame);

            UnityCoroutineRunner.InitializeGameObject(name, ref _go, mustSurvive);

            var runnerBehaviour = _go.AddComponent <RunnerBehaviourUpdate>();
            var runnerBehaviourForUnityCoroutine = _go.AddComponent <RunnerBehaviour>();
            var info = new UnityCoroutineRunner.RunningTasksInfo {
                runnerName = name
            };

            runnerBehaviour.StartUpdateCoroutine(new UnityCoroutineRunner.Process
                                                     (_newTaskRoutines, _coroutines, _flushingOperation, info,
                                                     StaggeredTasksFlushing,
                                                     runnerBehaviourForUnityCoroutine, StartCoroutine));
        }
        public StaggeredMonoRunner(string name, int maxTasksPerFrame)
        {
            _flushingOperation = new FlushingOperationStaggered(maxTasksPerFrame);

            UnityCoroutineRunner.InitializeGameObject(name, ref _go);

            var coroutines      = new FasterList <IPausableTask>(NUMBER_OF_INITIAL_COROUTINE);
            var runnerBehaviour = _go.AddComponent <RunnerBehaviourUpdate>();
            var runnerBehaviourForUnityCoroutine = _go.AddComponent <RunnerBehaviour>();

            _info = new UnityCoroutineRunner.RunningTasksInfo {
                runnerName = name
            };

            runnerBehaviour.StartUpdateCoroutine(UnityCoroutineRunner.Process
                                                     (_newTaskRoutines, coroutines, _flushingOperation, _info,
                                                     StaggeredTasksFlushing,
                                                     runnerBehaviourForUnityCoroutine, StartCoroutine));
        }