start method
Future<List<DFTilePosition> >
start(
- List<
List< blockMap,int> > - DFAStarNode startNode,
- DFAStarNode endNode
开始算法
Implementation
Future<List<DFTilePosition>> start(List<List<int>> blockMap, DFAStarNode startNode, DFAStarNode endNode) async {
/// Map数据
DFAStarMap map = DFAStarMap(blockMap, blockMap[0].length, blockMap.length, startNode, endNode);
/// clean
_openList.clear();
_closeList.clear();
_pathList.clear();
/// 开始搜索
_openList.add(map.start);
/// 优先队列(升序)
_openList.sort((a, b) => a.compareTo(b));
moveNodes(map);
/// 删掉起点
if (this._pathList.length > 0) {
this._pathList.removeLast();
}
/// 返回路径
return this._pathList;
}