예제 #1
0
    /// <summary>
    /// Updates the nodes on the graph to represent the current status of the algorithm
    /// </summary>
    private void UpdateGraphUI(Node start, Node goal)
    {
        // color frontier, explored and path Nodes
        if (m_frontierNodes != null)
        {
            graphController.ColorNodes(m_frontierNodes.ToList(), graphController.frontierColor);
        }
        if (m_exploredNodes != null)
        {
            graphController.ColorNodes(m_exploredNodes, graphController.exploredColor);
        }
        if (m_pathNodes != null && m_pathNodes.Count > 0)
        {
            graphController.ColorNodes(m_pathNodes, graphController.pathColor);
        }

        // color start NodeView and goal NodeView directly
        NodeView startNodeView = graphController.nodeViews[start.xIndex, start.yIndex];

        startNodeView.SetColorNode(graphController.startNodeColor);
        NodeView goalNodeView = graphController.nodeViews[goal.xIndex, goal.yIndex];

        goalNodeView.SetColorNode(graphController.endNodeColor);
    }