Ejemplo n.º 1
0
        public void Execute()
        {
            // iterate nodes
            Debug.Log("Execute!");

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

            ExecData data = new ExecData();

            // Execute through the graph until we run out of nodes to execute
            ExecNode 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.");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        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"));
        }