public override bool Update() { Vector3 curent; for (int i = 0; i < 10; i++) { if (firstIndex >= foots.Count) { return(false); } curent = foots.Keys.ElementAt(firstIndex); firstIndex++; for (int z = 0; z < 3; z++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { Vector3 temp = curent + new Vector3(x - 1, y - 1, z - 1); if (!foots.ContainsKey(temp) && Go.CanGo(temp)) { foots.Add(temp, curent); if (Main.main.GetBlock(temp) == -100) { POI poiT = null; if (item != null) { poiT = Main.main.CheckPOI(temp, task.owner, type, new object[] { item }); } else { poiT = Main.main.CheckPOI(temp, task.owner, type); } if (poiT != null) { MonoBehaviour.print("znalazlem"); poi = poiT; List <Vector3> path2 = new List <Vector3>(); Vector3 t3 = temp; while (foots[t3] != new Vector3(-1, -1, -1)) { path2.Add(t3); t3 = foots[t3]; } path = path2.ToArray(); return(false); } } } } } } } return(true); }
Vector3[] Search(int _target) { Vector3 curent; for (int i = 0; i < 10; i++) { if (firstIndex >= foots.Count) { print("nie znalazlem :("); searching = false; return(null); } curent = foots.Keys.ElementAt(firstIndex); firstIndex++; for (int z = 0; z < 3; z++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { Vector3 temp = curent + new Vector3(x - 1, y - 1, z - 1); if (!foots.ContainsKey(temp) && Go.CanGo(temp)) { foots.Add(temp, curent); if (Main.main.GetBlock(temp) == _target) { //Task temp2 = Willage.willage.GetTask(temp); // if (temp2 != null) //{ // searching = false; List <Vector3> path = new List <Vector3>(); Vector3 t3 = temp; while (foots[t3] != new Vector3(-1, -1, -1)) { path.Add(t3); t3 = foots[t3]; } // temp2.Take(this,path.ToArray()); return(path.ToArray()); } } } } } } return(null); }