public void Distribute (Node[] nodes, Rect r) {
Vector2 c = r.center;
while (linkedList != null) {
Agent nx = linkedList.next;
if (linkedList.position.x > c.x) {
if (linkedList.position.z > c.y) {
nodes[child11].Add(linkedList);
} else {
nodes[child10].Add(linkedList);
}
} else {
if (linkedList.position.z > c.y) {
nodes[child01].Add(linkedList);
} else {
nodes[child00].Add(linkedList);
}
}
linkedList = nx;
}
count = 0;
}
}