Exemplo n.º 1
0
        public void UpdateGraph()
        {
            nodes.Clear();
            GameObject[] n = GameObject.FindGameObjectsWithTag("Node");
            foreach (var node in n)
            {
                Node noeud = node.GetComponent <Node>();
                if (noeud.getNeighbors().Count() > 0)
                {
                    nodes.Add(noeud);
                }
            }

            // nodes = FindObjectsOfType<Node>();
            for (var i = 0; i < nodes.Count; i++)
            {
                nodes[i].initialize();
            }

            if (isOriginal)
            {
                //take care of all the copies of the graph
                BasicAI[] allBasicAI = FindObjectsOfType <BasicAI>();
                for (int i = 0; i < allBasicAI.Length; i++)
                {
                    allBasicAI[i].ScheduledGraphUpdate();
                }
            }

            // foreach (var VARIABLE in nodes)
            // {
            //     print(VARIABLE);
            //     print(VARIABLE.getPosition());
            // }
        }
Exemplo n.º 2
0
        // Start is called before the first frame update
        private void Start()
        {
            GameObject[] n = GameObject.FindGameObjectsWithTag("Node");
            foreach (var node in n)
            {
                Node noeud = node.GetComponent <Node>();
                if (noeud.getNeighbors().Count() > 0)
                {
                    nodes.Add(noeud);
                }
            }

            // nodes = FindObjectsOfType<Node>();
            drawGraph(DrawGraph);
        }
Exemplo n.º 3
0
        public Graph CopyGraph()
        {
            Graph temp = new Graph();

            temp.nodes = new List <Node>();
            GameObject[] n = GameObject.FindGameObjectsWithTag("Node");
            foreach (var node in n)
            {
                Node noeud = node.GetComponent <Node>();
                if (noeud.getNeighbors().Count() > 0)
                {
                    temp.nodes.Add(noeud);
                }
                //temp.nodes.Add(node.GetComponent<Node>());
            }
            temp.DrawGraph  = DrawGraph;
            temp.isOriginal = false;
            return(temp);
        }