public List<int> PerformSearch(HierarchicalMap map, int startNodeId, int targetNodeId, int level, bool mainSearch) { var search = new AStar(); map.SetCurrentLevel(level); var nodeInfo = map.AbstractGraph.GetNodeInfo(startNodeId); if (mainSearch) map.SetCurrentCluster(nodeInfo.Position, map.MaxLevel + 1); else map.SetCurrentCluster(nodeInfo.Position, level + 1); // TODO: This could be perfectly replaced by cached paths in the clusters! var path = search.FindPath(map, startNodeId, targetNodeId); if (path.PathCost == -1) { // No path found return new List<int>(); } var result = path.PathNodes; result.Reverse(); return result; }