public void LoadMap()
    {
        displayedResult = null; //Reset the displayed result
        Clear();

        FileInfo current     = maps[uiCtrl.DdlMaps.value];
        int      ClusterSize = uiCtrl.Cluster.GetValue();
        int      LayerDepth  = uiCtrl.Layers.GetValue();

        map = Map.LoadMap(current.FullName);

        float deltaT;

        graph = RunGenerateGraph(LayerDepth, ClusterSize, out deltaT);
        uiCtrl.ClusterTime.text = string.Format("{0} s", deltaT);

        uiCtrl.FillLayers(graph.depth);

        camControl.ResetDefaultPosition(map.Width, map.Height);
        SceneMapDisplay.SetMap(map);

        //Automatically draw the last layer when we load a new map
        if (graph.depth == 0)
        {
            SceneMapDisplay.DrawClusters(map, null);
        }
        else
        {
            SceneMapDisplay.DrawClusters(map, graph.C[graph.depth - 1]);
        }
    }
 void HandleClusterStateChange()
 {
     if (showClusters != lastClusterActiveState)
     {
         SceneMapDisplay.ToggleClusters(showClusters);
         lastClusterActiveState = showClusters;
     }
 }
    public void LoadMap()
    {
        map = Map.LoadMap(mapName);

        graph = new Graph(map, layers, clusterSize);

        // TODO: update camera default position
        SceneMapDisplay.SetMap(map);
        SceneMapDisplay.DrawClusters(map, graph.C.LastOrDefault());

        SceneMapDisplay.ToggleClusters(showClusters);
    }
    /// <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);
        }
    }