Files
esengine/source/src/AI/Pathfinding/AStar/IAstarGraph.ts

25 lines
703 B
TypeScript
Raw Normal View History

2020-07-23 11:00:46 +08:00
module es {
2020-07-09 16:36:42 +08:00
/**
2020-07-23 11:00:46 +08:00
* graph的接口AstarPathfinder.search方法
2020-07-09 16:36:42 +08:00
*/
2020-07-23 11:00:46 +08:00
export interface IAstarGraph<T> {
/**
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点
* @param node
*/
getNeighbors(node: T): Array<T>;
/**
* from到to的成本
* @param from
* @param to
*/
cost(from: T, to: T): number;
/**
* node到to的启发式WeightedGridGraph了解常用的Manhatten方法
* @param node
* @param goal
*/
heuristic(node: T, goal: T);
}
}