Beispiel #1
0
    private void ShowColours(GraphView graphView, Node start, Node goal, bool lerpColour = false, float lerpValue = 0.5f)
    {
        if (graphView == null || start == null || goal == null)
        {
            Debug.LogWarning("PATHFINDER - Show colours error, missing arguments");
            return;
        }

        if (frontierNodes != null)
        {
            graphView.ColourNodes(frontierNodes.ToList(), frontierColour, lerpColour, lerpValue);
        }

        if (exploredNodes != null)
        {
            graphView.ColourNodes(exploredNodes, exploredColour, lerpColour, lerpValue);
        }

        if (pathNodes != null && pathNodes.Count > 0)
        {
            graphView.ColourNodes(pathNodes, pathColour, lerpColour, lerpValue * 1.5f);
        }

        NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex];

        if (startNodeView != null)
        {
            startNodeView.ColourNode(startColour);
        }

        NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex];

        if (goalNodeView != null)
        {
            goalNodeView.ColourNode(goalColour);
        }
    }