public static RoutineExecutionHandler Add(Routine routine, RoutineExecutionScope executionScope, ExecutionOrder executionOrder, bool prelude) { // if (prelude && !RoutineUtilities.OneStep(routine)) // return new RoutineExecutionHandler(routine, executionScope, executionOrder); var worker = executionScope == RoutineExecutionScope.Scene ? GetSceneWorker() : GetPermanentWorker(); worker.Add(routine, executionOrder); return(new RoutineExecutionHandler(routine, executionScope, executionOrder)); }
public static RoutineExecutionHandler InBackground(this Routine self, RoutineExecutionScope scope, bool prelude = true) => InBackground(self, ExecutionOrder.Update, scope, prelude);
public RoutineExecutionHandler(Routine routine, RoutineExecutionScope scope, ExecutionOrder executionOrder) { Routine = routine; Scope = scope; ExecutionOrder = executionOrder; }
/// <summary> /// Запускает и обрабатывает рутину в фоне /// </summary> /// <param name="self"></param> /// <param name="executionOrder">Определяет в какой момент обрабатывается рутина</param> /// <param name="scope">Определяет время жизни обработки рутины</param> /// <param name="prelude">true - если перед помещением рутины в worker необходимо проиграть рутину до первого yield, иначе - false</param> /// <returns></returns> public static RoutineExecutionHandler InBackground(this Routine self, ExecutionOrder executionOrder = ExecutionOrder.Update, RoutineExecutionScope scope = RoutineExecutionScope.Scene, bool prelude = true) => RoutineWorkerHub.Add(self, scope, executionOrder, prelude);