コード例 #1
0
        public float Process(PWGraph graph)
        {
            float calculTime = 0f;
            bool  realMode   = graph.IsRealMode();

            currentGraph = graph;

            hasProcessed = false;

            if (graph.GetComputeSortedNodes() == null)
            {
                graph.UpdateComputeOrder();
            }

            try {
                foreach (var node in graph.GetComputeSortedNodes())
                {
                    //ignore unlinked nodes
                    if (node.computeOrder < 0)
                    {
                        continue;
                    }

                    calculTime += ProcessNode(node, realMode);
                }
            } catch (Exception e) {
                Debug.LogError(e);
                Debug.Log("Stopping graph processing due to an unexpected error");
                return(calculTime);
            }

            hasProcessed = true;

            return(calculTime);
        }
コード例 #2
0
        public void     ProcessOnce(PWGraph graph)
        {
            if (graph.GetComputeSortedNodes() == null)
            {
                graph.UpdateComputeOrder();
            }

            currentGraph = graph;

            foreach (var node in graph.GetComputeSortedNodes())
            {
                //ignore unlinked nodes
                if (node.computeOrder < 0)
                {
                    continue;
                }

                node.OnNodeProcessOnce();

                ProcessNodeLinks(node, graph.IsRealMode());
            }
        }
コード例 #3
0
        public float ProcessNodes(PWGraph graph, List <PWNode> nodes)
        {
            float calculTime = 0f;
            bool  realMode   = graph.IsRealMode();

            currentGraph = graph;

            //sort nodes by compute order:
            nodes.Sort((n1, n2) => n1.computeOrder.CompareTo(n2.computeOrder));

            foreach (var node in nodes)
            {
                if (node.computeOrder < 0)
                {
                    continue;
                }

                calculTime += ProcessNode(node, realMode);
            }

            return(calculTime);
        }