public override void OnInspectorGUI() { DrawDefaultInspector(); TestAStar testAStar = (TestAStar)target; GUILayout.Space(10); if (GUILayout.Button("Calcular A*")) { testAStar.CallTestAStar(); } }
/// <summary> /// Create the A Star agents /// </summary> public void CreateAgents() { for (int i = 0; i < AgentUtility.agentCount; i++) { GameObject testAstarInstance = Instantiate(testAstar, parentAstar.transform); GameObject lineDrawerInstance = Instantiate(lineDrawer, parentLineDrawers.transform); TestAStar testAstarScript = testAstarInstance.GetComponent <TestAStar>(); testAstarScript.lineDrawer = lineDrawerInstance.GetComponent <LineDrawer>(); testAstarScript.lineDrawer.SetLineRendererParent(parentLineRenderer); testAstarScript.graphView = this.graphView; testAstarScript.startNode = graphView.NodeViewCollection[graphView.startNodesIndex[i]]; testAstarScript.destinyNode = graphView.NodeViewCollection[graphView.destinyNodesIndex[i]]; agents.Add(testAstarScript); } }