コード例 #1
0
ファイル: ExecGraph.cs プロジェクト: moto2002/BlueGraph
        public void Execute()
        {
            // iterate nodes
            Debug.Log("Execute!");

            if (entryPoint == null)
            {
                Debug.LogError($"<b>[{name}]</b> No EntryPoint node found", this);
                return;
            }

            ExecData data = new ExecData();

            // Execute through the graph until we run out of nodes to execute
            ICanExec next        = entryPoint;
            int      sanityCheck = 0;

            while (next != null)
            {
                next = next.Execute(data);

                // Just in case :)
                sanityCheck++;
                if (sanityCheck > 2000)
                {
                    Debug.LogError("Potential infinite loop detected. Stopping early.", this);
                    break;
                }
            }
        }
コード例 #2
0
ファイル: DllMain.cs プロジェクト: dahanj95/Modules
 public override async void Execute(ExecData req)
 {
     using (WebClient wc = new WebClient())
     {
         string text = wc.DownloadString(api);
         await Client.SendText(text, replyId : req.FromMessageId);
     }
 }
コード例 #3
0
ファイル: DllMain.cs プロジェクト: dahanj95/Modules
 public override async void Execute(ExecData req)
 {
     try
     {
         await Client.SendPic(GetPicStream(), replyId : req.FromMessageId);
     }
     catch (Exception e)
     {
         await Client.SendText(e.Message, replyId : req.FromMessageId);
     }
 }
コード例 #4
0
        public override ExecNode Execute(ExecData data)
        {
            bool condition = GetInputValue("Condition", this.condition);

            if (!condition)
            {
                return(GetNextExec("Else"));
            }

            // True (default) case
            return(base.Execute(data));
        }
コード例 #5
0
        public override ExecNode Execute(ExecData data)
        {
            GameObject go       = GetInputValue <GameObject>("Prefab", null);
            GameObject pgo      = GetInputValue <GameObject>("Parent", null);
            Vector3    position = GetInputValue("Local Position", localPosition);
            Quaternion rotation = GetInputValue("Local Rotation", localRotation);

            if (go)
            {
                instance = Instantiate(go, position, rotation, pgo?.transform);
            }

            return(base.Execute(data));
        }
コード例 #6
0
ファイル: Print.cs プロジェクト: Avatarchik/BlueGraph
        public override ExecNode Execute(ExecData data)
        {
            string value = GetInputValue("Value", this.value);
            object obj   = GetInputValue("Obj", this.obj);

            string message = $"{value}{obj}";

            switch (level)
            {
            case LogLevel.Info: Debug.Log(message); break;

            case LogLevel.Warning: Debug.LogWarning(message); break;

            case LogLevel.Error: Debug.LogError(message); break;
            }

            return(base.Execute(data));
        }
コード例 #7
0
ファイル: Loop.cs プロジェクト: Avatarchik/BlueGraph
        public override ExecNode Execute(ExecData data)
        {
            int count = GetInputValue("Count", this.count);

            // Execution does not leave this node until the loop completes.
            // Not sure if I like this idea, but it's the simplest version.
            // This implies we repeat the code from ExecGraph.Execute though
            for (m_currentCount = 0; m_currentCount < count; m_currentCount++)
            {
                ExecNode next = GetNextExec();
                while (next)
                {
                    next = next.Execute(data);
                }
            }

            return(GetNextExec("Then"));
        }
コード例 #8
0
 /// <summary>
 /// Execute this node and return the next node to be executed.
 /// Override with your custom execution logic.
 /// </summary>
 /// <returns></returns>
 public virtual ICanExec Execute(ExecData data)
 {
     // noop.
     return(GetNextExec());
 }
コード例 #9
0
ファイル: ExecFuncNode.cs プロジェクト: moto2002/BlueGraph
 public ICanExec Execute(ExecData data)
 {
     ExecuteMethod();
     return(GetNextExec());
 }
コード例 #10
0
ファイル: ExecNode.cs プロジェクト: Avatarchik/BlueGraph
 /// <summary>
 /// Execute this node and return the next node to be executed.
 /// Override with your custom execution logic.
 /// </summary>
 /// <returns></returns>
 public virtual ExecNode Execute(ExecData data)
 {
     // noop.
     return(GetNextExec());
 }