public override void OnDrawGizmos(bool drawNodes)
{
//GenerateMatrix ();
Gizmos.matrix = boundsMatrix;
Gizmos.color = Color.white;
Gizmos.DrawWireCube (Vector3.zero, new Vector3 (size.x,0,size.y));
Gizmos.matrix = Matrix4x4.identity;
if (!drawNodes) {
return;
}
if (nodes == null || depth*width != nodes.Length) {
//Scan (AstarPath.active.GetGraphIndex (this));
return;
}
base.OnDrawGizmos (drawNodes);
for (int z = 0; z < depth; z ++) {
for (int x = 0; x < width; x++) {
GridNode node = nodes[z*width+x] as GridNode;
if (!node.walkable) {// || node.activePath != AstarPath.active.debugPath)
continue;
}
//Gizmos.color = node.walkable ? Color.green : Color.red;
//Gizmos.DrawSphere (node.position,0.2F);
Gizmos.color = NodeColor (node,AstarPath.active.debugPathData);
//if (true) {
// Gizmos.DrawCube (node.position,Vector3.one*nodeSize);
//}
//else
if (AstarPath.active.showSearchTree && AstarPath.active.debugPathData != null) {
if (InSearchTree(node,AstarPath.active.debugPath)) {
NodeRun nodeR = node.GetNodeRun (AstarPath.active.debugPathData);
NodeRun parentR = nodeR.parent;
if (parentR != null)
Gizmos.DrawLine ((Vector3)node.position, (Vector3)parentR.node.position);
}
} else {
for (int i=0;i<8;i++) {
if (node.GetConnection (i)) {
GridNode other = nodes[node.GetIndex ()+neighbourOffsets[i]] as GridNode;
Gizmos.DrawLine ((Vector3)node.position, (Vector3)other.position);
}
}
}
}
}
}