Beispiel #1
0
        public override IExecutableNode Execute(ExecutionFlowData data)
        {
            string msg     = GetInputValue("message", message);
            object obj     = GetInputValue("obj", this.obj);
            Object context = GetInputValue("context", this.context);

            if (obj != null)
            {
                msg += obj.ToString();
            }

            switch (mode)
            {
            case LogMode.Debug:
                Debug.Log(msg, context);
                break;

            case LogMode.Warning:
                Debug.LogWarning(msg, context);
                break;

            case LogMode.Error:
                Debug.LogError(msg, context);
                break;

            default: break;
            }

            return(base.Execute(data));
        }
Beispiel #2
0
        public override IExecutableNode Execute(ExecutionFlowData data)
        {
            bool condition = GetInputValue("Condition", this.condition);

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

            // True (default) case
            return(base.Execute(data));
        }
Beispiel #3
0
        public override IExecutableNode Execute(ExecutionFlowData data)
        {
            int count = GetInputValue("Count", this.count);

            // Execution does not leave this node until the loop completes
            IExecutableNode next = GetNextExecutableNode();

            for (current = 0; current < count; current++)
            {
                (Graph as MonoBehaviourGraph).Execute(next, data);
            }

            return(GetNextExecutableNode("Then"));
        }
Beispiel #4
0
        /// <summary>
        /// Execute the graph starting from the given parent node
        /// </summary>
        public void Execute(IExecutableNode root, ExecutionFlowData data)
        {
            // Execute through the graph until we run out of nodes to execute.
            // Each node will return the next node to be executed in the path.
            IExecutableNode next       = root;
            int             iterations = 0;

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

                iterations++;
                if (iterations > 2000)
                {
                    Debug.LogError("Potential infinite loop detected. Stopping early.", this);
                    break;
                }
            }
        }
 /// <summary>
 /// Execute this node and return the next node to be executed.
 /// Override with your custom execution logic.
 /// </summary>
 /// <returns></returns>
 public virtual IExecutableNode Execute(ExecutionFlowData data)
 {
     // noop.
     return(GetNextExecutableNode());
 }