//请求Astar寻路 public static void RequestPathFind(MapGridNode beginNode, MapGridNode endNode, MapInfo mapInfo, AstarResult callback, Object targetObj = null) { //TODO 通过策略,决定用什么寻路方法,此处用Astar AstarPathFinder pathFinder = new AstarPathFinder(beginNode, endNode, mapInfo, callback); pathFinder.FindPath(); }
void Start() { // setup all vars mouseOverIndicator = GameObject.FindGameObjectWithTag("MouseOverIndicator"); selectionTileIndicator = GameObject.FindGameObjectWithTag("SelectionTileIndicator"); pathIndicator = GameObject.FindGameObjectWithTag("PathIndicator"); pathExploredIndicator = GameObject.FindGameObjectWithTag("PathExploredIndicator"); // create GUI style guiStyle = new GUIStyle(); guiStyle.alignment = TextAnchor.LowerLeft; guiStyle.normal.textColor = Utilities.hexToColor("#153870"); AstarPF = new AstarPathFinder(maxDepth: 50, maxCost: 50, maxIncrementalCost: GameControl.gameSession.humanPlayer.getMaxActionPoints()); DijsktraPF = new DijkstraPathFinder(maxDepth: GameControl.gameSession.humanPlayer.getMaxActionPoints(), maxCost: GameControl.gameSession.humanPlayer.getActionPoints(), maxIncrementalCost: GameControl.gameSession.humanPlayer.getMaxActionPoints() ); }