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);
}
PathHandler debugData = AstarPath.active.debugPathData;
for (int i=0;i<nodes.Length;i++) {
TriangleMeshNode node = (TriangleMeshNode)nodes[i];
Gizmos.color = NodeColor (node,AstarPath.active.debugPathData);
if (node.Walkable ) {
if (AstarPath.active.showSearchTree && debugData != null && debugData.GetPathNode(node).parent != null) {
Gizmos.DrawLine ((Vector3)node.position,(Vector3)debugData.GetPathNode(node).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.v0],(Vector3)vertices[node.v1]);
Gizmos.DrawLine ((Vector3)vertices[node.v1],(Vector3)vertices[node.v2]);
Gizmos.DrawLine ((Vector3)vertices[node.v2],(Vector3)vertices[node.v0]);
}
}