public void ShowColors(GraphView _graphView, Node _start, Node _goal, bool lerpColor = false, float lerpValue = 0.5f) { if (_graphView == null || _start == null || _goal == null) { return; } if (this.frontierNodes != null) { _graphView.ColorNodes(frontierNodes.ToList(), frontierNodesColor, lerpColor, lerpValue); } if (this.exploredNodes != null) { _graphView.ColorNodes(exploredNodes, exploredNodesColor, lerpColor, lerpValue); } if (this.pathNodes != null && pathNodes.Count > 0) { graphView.ColorNodes(this.pathNodes, pathNodeColor, lerpColor, lerpValue * 2f); } NodeView startNodeView = graphView.NodeViews[_start.XIndex, _start.YIndex]; if (startNodeView != null) { startNodeView.ColorNode(this.startNodesColor); } NodeView goalNodeView = graphView.NodeViews[_goal.XIndex, _goal.YIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(this.goalNodesColor); } }
void DisplayColors(GraphView graphView, Node start, Node goal) { if (graphView == null || start == null || goal == null) { Debug.Log("DisplayColors returned"); return; } if (m_frontierNodes != null) { graphView.ColorNodes(m_frontierNodes.ToList(), frontierColor); } if (m_exploredNodes != null) { graphView.ColorNodes(m_exploredNodes, exploredColor); } //Color Path if (m_pathNodes != null && m_pathNodes.Count > 0) { Debug.Log("Coloring Path"); graphView.ColorNodes(m_pathNodes, pathColor); } NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (startNodeView != null && goalNodeView != null) { startNodeView.ColorNode(startColor); goalNodeView.ColorNode(goalColor); } }
private void ShowColors(GraphView graphView, Node startNode, Node endNode) { if (frontierNodes != null) { graphView.ColorNodes(frontierNodes.ToList(), frontierColor); } if (exploredNodes != null) { graphView.ColorNodes(exploredNodes, exploredColor); } if (pathNodes != null && pathNodes.Count > 0) { graphView.ColorNodes(pathNodes, pathColor); } NodeView startNodeView = graphView.nodeViews[startNode.xIndex, startNode.yIndex]; if (startNodeView != null) { startNodeView.ChangeNodeColor(startColor); } NodeView endNodeView = graphView.nodeViews[endNode.xIndex, endNode.yIndex]; if (endNodeView != null) { endNodeView.ChangeNodeColor(endColor); } }
private void ColorPathNodes() { if (m_pathNodes != null && m_pathNodes.Count > 0) { m_graphView.ColorNodes(m_pathNodes, pathColor, m_lerpColor, m_lerpValue * 2f); } }
/// <summary> /// Change the colors of nodes /// </summary> /// <param name="graphView"></param> /// <param name="start"></param> /// <param name="goal"></param> void ShowColors(GraphView graphView, Node start, Node goal, bool lerpColor = false, float lerpValue = 0.5f) { if (graphView == null || start == null || goal == null) { return; } // for diagnostic purposes if (m_frontierNodes != null) { graphView.ColorNodes(m_frontierNodes.ToList(), frontierColor, lerpColor, lerpValue); } // for diagnostic purposes if (m_exploredNodes != null) { graphView.ColorNodes(m_exploredNodes, exploredColor, lerpColor, lerpValue); } if (m_pathNodes != null && m_pathNodes.Count > 0) { graphView.ColorNodes(m_pathNodes, pathColor, lerpColor, lerpValue * 2f); } // Set up the start node NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; if (startNodeView != null) { startNodeView.ColorNode(startColor); } // Set up the goal node NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(goalColor); } }
private void ShowColors(GraphView graphView, Node start, Node goal) { if (graphView == null || start == null || goal == null) { return; } if (m_frontierNodes != null) { graphView.ColorNodes(m_frontierNodes.ToList(), frontierColor); } if (m_exploredNodes != null) { graphView.ColorNodes(m_exploredNodes.ToList(), exploredColor); } if (m_pathNodes != null && m_pathNodes.Count > 0) { graphView.ColorNodes(m_pathNodes, pathColor); } NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; if (startNodeView != null) { startNodeView.ColorNode(startColor); } NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(goalColor); } }
private void ShowColors(GraphView graphView, Node start, Node goal) { if (start == null || goal == null || graphView == null) { Debug.LogWarning("PATHFINDER Init error: missing component(s)!"); return; } if (m_frontierNodes != null) { graphView.ColorNodes(m_frontierNodes.ToList(), frontierColor); } if (m_exploreNodes != null) { graphView.ColorNodes(m_exploreNodes, exploredColor, 0.5f); } if (m_pathNodes != null && m_pathNodes.Count > 0) { graphView.ColorNodes(m_pathNodes, pathColor); graphView.ShowNodeArrows(m_pathNodes, highlightColor); } NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; if (startNodeView != null) { startNodeView.ColorNode(startColor); } NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(goalColor); } }
private void ShowColors(GraphView graphView, Node start, Node goal, bool lerpColor = false, float lerpValue = 0.5f) { if (start == null || goal == null || graph == null || graphView == null) { return; } if (frontierNodes != null) { graphView.ColorNodes(frontierNodes.ToList(), frontierColor, lerpColor, lerpValue); } if (exploredNodes != null) { graphView.ColorNodes(exploredNodes, exploredColor, lerpColor, lerpValue); } if (pathNodes != null && pathNodes.Count > 0) { graphView.ColorNodes(pathNodes, pathColor, lerpColor, lerpValue * 2f); } NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; if (startNodeView != null) { startNodeView.ColorNode(startColor); } NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(goalColor); } }
void ShowColors(GraphView graphView, Node start, Node goal, bool lerpColor = false, float lerpValue = 0.5f) { if (graphView == null || start == null || goal == null) { return; } if (m_frontierNodes != null) { graphView.ColorNodes(m_frontierNodes.ToList(), frontierColor, lerpColor, lerpValue); // 给 frontierNodes 上色 } if (m_exploredNodes != null) { graphView.ColorNodes(m_exploredNodes, exploredColor, lerpColor, lerpValue); // 给 exploredNodes 上色 } if (m_pathNodes != null && m_pathNodes.Count > 0) { graphView.ColorNodes(m_pathNodes, pathColor, lerpColor, lerpValue * 2); // 给 pathNode 上色 } NodeView startNodeView = graphView.nodeViews[start.xIndex, start.yIndex]; if (startNodeView != null) { startNodeView.ColorNode(startColor); // 给 startNode 上色 } NodeView goalNodeView = graphView.nodeViews[goal.xIndex, goal.yIndex]; if (goalNodeView != null) { goalNodeView.ColorNode(goalColor); // 给 goalNode 上色 } }