Пример #1
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (condition.Evaluate(context, onFailed))
     {
         var script = new EventScript();
         script.CommandList        = ifTrue;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, handle.Complete);
     }
     else
     {
         var script = new EventScript();
         script.CommandList        = ifFalse;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, handle.Complete);
     }
 }
Пример #2
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (inheritVariables)
     {
         var script = scriptAsset.Script;
         script.WaitForAllCommands = true;
         context.InsertInherit(script, handle.Complete);
     }
     else
     {
         context.Insert(scriptAsset, handle.Complete, null);
     }
 }
Пример #3
0
 private void UpdateLoop(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (condition.Evaluate(context))
     {
         var script = new EventScript();
         script.CommandList        = routine;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, () => UpdateLoop(context, handle));
     }
     else
     {
         handle.Complete();
     }
 }
Пример #4
0
        private void UpdateLoop(EventExecutionContext context, CommandExecutionHandle handle)
        {
            counter++;
            if (count.Evaluate(context, out object result))
            {
                if (result is IComparable resultComparable && counter.CompareTo(resultComparable) < 0)
                {
                    var script = new EventScript();
                    script.CommandList        = routine;
                    script.WaitForAllCommands = waitForAllCommand;
                    context.InsertInherit(script, () => UpdateLoop(context, handle));
                    return;
                }
            }

            handle.Complete();
        }