コード例 #1
0
        public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
        {
            if (target.Evaluate(context, out object result))
            {
                string message = "";
                switch (target.StoreType)
                {
                case VariableReferenceType.Constant:
                    message = "定数";
                    break;

                case VariableReferenceType.Temporary:
                    message = "一時変数";
                    break;

                case VariableReferenceType.Event:
                    message = "イベント変数";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                message += ": " + result;
                Debug.Log(message);
            }

            handle.Complete();
        }
コード例 #2
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (duration.Evaluate(context, out float durationValue))
     {
         currentHandle = handle;
         Timer.AddTimer(durationValue, Tick, updateMode);
     }
     else
     {
         handle.Complete();
     }
 }
コード例 #3
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);
     }
 }
コード例 #4
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();
     }
 }
コード例 #5
0
        private void AdvanceLine()
        {
            if (IsFreezed)
            {
                IsAdvanceLineProposed = true;
                return;
            }

            CurrentLine++;
            if (CurrentLine >= Commands.Count)
            {
                IsAllCommandDispatched = true;
                EndIfComplete();
                return;
            }

            var current = Commands[CurrentLine];
            CommandExecutionHandle handle;

            IncreaseRunningCommandCount();
            switch (current.Synchronization)
            {
            //case CommandSynchronizationType.Sync:
            case CommandSynchronizationType.Async:
                handle = new CommandExecutionHandle(OnAsyncCommandFinished);
                try
                {
                    current.Execute(CurrentContext, handle);
                }
                catch (Exception e)
                {
                    CurrentContext.RaiseError(e);
                }

                AdvanceLine();
                break;

            default:
                handle = new CommandExecutionHandle(OnSyncCommandFinished);
                try
                {
                    current.Execute(CurrentContext, handle);
                }
                catch (Exception e)
                {
                    CurrentContext.RaiseError(e);
                }
                break;
            }
        }
コード例 #6
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();
        }
コード例 #7
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);
     }
 }
コード例 #8
0
        public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
        {
            if (target == null || value == null)
            {
                Debug.LogWarning("VariableReferenceが未設定です。");
                handle.Complete();
                return;
            }

            if (target.ValueType != value.ValueType)
            {
                Debug.LogWarning("VariableReferenceの型が一致しません。");
                handle.Complete();
                return;
            }

            if (value.Evaluate(context, out var evaluated))
            {
                target.SetValue(context, evaluated);
            }
            handle.Complete();
        }
コード例 #9
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     UpdateLoop(context, handle);
 }
コード例 #10
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     calculation.Execute(context);
     handle.Complete();
 }
コード例 #11
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     currentHandle = handle;
     Timer.AddFrameTimer(frames, Tick);
 }
コード例 #12
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     Debug.Log(message);
     handle.Complete();
 }
コード例 #13
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     handle.Complete();
 }
コード例 #14
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     ev.Invoke(context.ReferenceResolver);
     handle.Complete();
 }