public override void OnDrawGizmos (bool drawNodes) {
if (!drawNodes) {
return;
}
base.OnDrawGizmos (false);
if (nodes == null) {
return;
}
PathHandler debugData = AstarPath.active.debugPathData;
for (int n=0;n<nodes.Length;n++) {
LevelGridNode node = nodes[n] as LevelGridNode;
if (node == null || !node.Walkable) continue;
//int index = node.GetIndex ();
Gizmos.color = NodeColor (node,AstarPath.active.debugPathData);
if (AstarPath.active.showSearchTree && AstarPath.active.debugPathData != null) {
if (InSearchTree(node,AstarPath.active.debugPath)) {
PathNode nodeR = debugData.GetPathNode (node);
if (nodeR != null && nodeR.parent != null) {
Gizmos.DrawLine ((Vector3)node.position, (Vector3)nodeR.parent.node.position);
}
}
} else {
for (int i=0;i<4;i++) {
int conn = node.GetConnectionValue(i);//(node.gridConnections >> i*4) & 0xF;
if (conn != LevelGridNode.NoConnection) {
int nIndex = node.NodeInGridIndex + neighbourOffsets[i] + width*depth*conn;
//nodeCellIndices[node.GetIndex ()+neighbourOffsets[i]]+conn;//index-node.nodeOffset+neighbourOffsets[i]+conn;
if (nIndex < 0 || nIndex > nodes.Length) {
continue;
}
GraphNode other = nodes[nIndex];
if (other == null) continue;
Gizmos.DrawLine ((Vector3)node.position,(Vector3)other.position);
}
}
}
}
}