private void FindNext() { // Si no tiene target es porque todavia no se invoco a internet if (target != null && LevelManager.instance.isServerInfected == false) { if (way != null && way.Length > 0) { actualPosWay++; if (actualPosWay >= way.Length) { way = new int[0]; FindNext(); return; } } else { AlgDijkstra.Dijkstra(LevelManager.instance.nodesGraph, target.Vertex); string[] caminos = AlgDijkstra.nodos; List <string> caminosDispo = new List <string>(); // Me guardo los caminos disponibles for (int i = 0; i < caminos.Length; i++) { if (caminos[i] != null) { caminosDispo.Add(caminos[i]); } } // Agarro un camino random string[] camino = caminosDispo[Random.Range(0, caminosDispo.Count)].Split(','); way = new int[camino.Length]; for (int i = 0; i < camino.Length; i++) { way[i] = int.Parse(camino[i]); } actualPosWay = 0; } NodeManager.Instance.nodesDictionary.TryGetValue(way[actualPosWay], out target); } else if (LevelManager.instance.isServerInfected == true) { HasDied(); } }
public void Dijkstra(int sourceNode) { (nodes1, nodes2) = AlgDijkstra.Dijkstra(this, sourceNode); }