private void calculatePath() { List <WorldTile> path = new List <WorldTile>(); LinkedList <WorldTile> openSet = new LinkedList <WorldTile>(); List <WorldTile> visited = new List <WorldTile>(); openSet.AddFirst(plantM.GetTile(Mathf.RoundToInt(gridPos.x), Mathf.RoundToInt(gridPos.y))); while (openSet.Count > 0) { WorldTile next = FindNearest(openSet); if (next != plantM.GetTile(Mathf.RoundToInt(targetPos.x), Mathf.RoundToInt(targetPos.y))) { WorldTile checkNode = openSet.First.Value; checkAdjacent(new Vector2(checkNode.x, checkNode.y)); for (int i = 0; i < adjacentPath.Length; i++) { if (adjacentPath[i] != null) { } else { plantM.GetTile(Mathf.RoundToInt(adjacentPath[i].x), Mathf.RoundToInt(adjacentPath[i].y)).previous = checkNode; openSet.AddFirst(plantM.GetTile(Mathf.RoundToInt(adjacentPath[i].x), Mathf.RoundToInt(adjacentPath[i].y))); openSet.Remove(checkNode); visited.Add(checkNode); } } } else { } } }