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; } } }
public override async void Execute(ExecData req) { using (WebClient wc = new WebClient()) { string text = wc.DownloadString(api); await Client.SendText(text, replyId : req.FromMessageId); } }
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); } }
public override ExecNode Execute(ExecData data) { bool condition = GetInputValue("Condition", this.condition); if (!condition) { return(GetNextExec("Else")); } // True (default) case return(base.Execute(data)); }
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)); }
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)); }
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")); }
/// <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()); }
public ICanExec Execute(ExecData data) { ExecuteMethod(); return(GetNextExec()); }
/// <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()); }