public override void OnDrawGizmos(bool drawNodes) { if (!drawNodes) { return; } Matrix4x4 preMatrix = matrix; GenerateMatrix(); if (nodes == null) { Scan(); } if (nodes == null) { return; } if (preMatrix != matrix) { //Debug.Log ("Relocating Nodes"); RelocateNodes(preMatrix, matrix); } for (int i = 0; i < nodes.Length; i++) { MeshNode node = (MeshNode)nodes[i]; Gizmos.color = NodeColor(node, AstarPath.active.debugPathData); if (node.walkable) { if (AstarPath.active.showSearchTree && AstarPath.active.debugPathData != null && node.GetNodeRun(AstarPath.active.debugPathData).parent != null) { Gizmos.DrawLine((Vector3)node.position, (Vector3)node.GetNodeRun(AstarPath.active.debugPathData).parent.node.position); } else { for (int q = 0; q < node.connections.Length; q++) { Gizmos.DrawLine((Vector3)node.position, (Vector3)node.connections[q].position); } } Gizmos.color = AstarColor.MeshEdgeColor; } else { Gizmos.color = Color.red; } Gizmos.DrawLine((Vector3)vertices[node.v1], (Vector3)vertices[node.v2]); Gizmos.DrawLine((Vector3)vertices[node.v2], (Vector3)vertices[node.v3]); Gizmos.DrawLine((Vector3)vertices[node.v3], (Vector3)vertices[node.v1]); } }
public override void OnDrawGizmos(bool drawNodes) { if (!drawNodes) { return; } if (bbTree != null) { bbTree.OnDrawGizmos(); } Gizmos.DrawWireCube(forcedBounds.center, forcedBounds.size); //base.OnDrawGizmos (drawNodes); if (nodes == null) { //Scan (AstarPath.active.GetGraphIndex (this)); } if (nodes == null) { return; } for (int i = 0; i < nodes.Length; i++) { //AstarColor.NodeConnection; MeshNode node = (MeshNode)nodes[i]; if (AstarPath.active.debugPathData != null && AstarPath.active.showSearchTree && node.GetNodeRun(AstarPath.active.debugPathData).parent != null) { //Gizmos.color = new Color (0,1,0,0.7F); Gizmos.color = NodeColor(node, AstarPath.active.debugPathData); Gizmos.DrawLine((Vector3)node.position, (Vector3)node.GetNodeRun(AstarPath.active.debugPathData).parent.node.position); } else { //for (int q=0;q<node.connections.Length;q++) { // Gizmos.DrawLine (node.position,node.connections[q].position); //} } /*Gizmos.color = AstarColor.MeshEdgeColor; * for (int q=0;q<node.connections.Length;q++) { * //Gizmos.color = Color.Lerp (Color.green,Color.red,node.connectionCosts[q]/8000F); * Gizmos.DrawLine (node.position,node.connections[q].position); * }*/ //Gizmos.color = NodeColor (node); //Gizmos.color.a = 0.2F; if (showMeshOutline) { Gizmos.color = NodeColor(node, AstarPath.active.debugPathData); Gizmos.DrawLine((Vector3)vertices[node.v1], (Vector3)vertices[node.v2]); Gizmos.DrawLine((Vector3)vertices[node.v2], (Vector3)vertices[node.v3]); Gizmos.DrawLine((Vector3)vertices[node.v3], (Vector3)vertices[node.v1]); } } }