public void DefinirTo(TextMeshProUGUI destino) { string opcion = destino.text; Node[] list = GameObject.FindObjectsOfType <Node>(); for (var i = 0; i < list.Length; i++) { /*if (list[i].gameObject.name == opcion) * { * m_To = list[i]; * //list[i].gameObject.GetComponent<Node>(). * }*/ if (list[i].gameObject.GetComponent <Node>().apodo == opcion) { m_To = list[i]; if (m_From != null && m_To != m_From) { m_Path = GetShortestPath(m_From, m_To); UbicacionScript uscript = m_From.GetComponent <UbicacionScript>(); uscript.DoChanges(m_Path.nodes[1]); } } Nombredestinopantalla.text = "Destino: " + opcion; } }
public void Definirorigen(Node origen) { m_From = origen; if (m_To != null && m_To != m_From) { m_Path = GetShortestPath(m_From, m_To); UbicacionScript uscript = m_From.GetComponent <UbicacionScript>(); uscript.DoChanges(m_Path.nodes[1]); } }