/// <summary> /// Function called when the button find path is clicked. /// Do pathfind for both implementation (A* and HPA*), given the nodes selected /// </summary> public void FindPath() { GridTile start = uiCtrl.Source.GetPositionField(); GridTile dest = uiCtrl.Destination.GetPositionField(); displayedResult = RunPathfind(start, dest); uiCtrl.HPAStarTime.text = string.Format("{0} s", displayedResult.HPAStarResult.RunningTime); uiCtrl.HPAStarLength.text = displayedResult.HPAStarResult.PathLength.ToString(); uiCtrl.AStarTime.text = string.Format("{0} s", displayedResult.AStarResult.RunningTime); uiCtrl.AStarLength.text = displayedResult.AStarResult.PathLength.ToString(); //Display the result SceneMapDisplay.DrawNormalPath(displayedResult.AStarResult.Path); SceneMapDisplay.DrawHpaPath(displayedResult.HPAStarResult.Path, graph.depth - uiCtrl.DdlLayers.value); }
/// <summary> /// Function called when the layer dropdown value has changed. /// Typically we want to show clusters related to the layer selected /// as well as resulting hierarchical paths. /// </summary> public void OnLayerChange() { int layer = uiCtrl.DdlLayers.value; if (layer == 0) { SceneMapDisplay.DrawClusters(map, null); //No clusters at the lower level } else { SceneMapDisplay.DrawClusters(map, graph.C[layer - 1]); } if (displayedResult != null) { SceneMapDisplay.DrawHpaPath(displayedResult.HPAStarResult.Path, graph.depth - layer); } }