void DrawCollision() { Gizmos.color = Color.yellow; foreach (GameObject collider in QuadtreeWithUpdateObject.CheckCollision(transform.position, _radius)) { Gizmos.DrawLine(transform.position, collider.transform.position); } }
private void OnDisable() { QuadtreeWithUpdateObject.RemoveLeaf(_leaf); }
private void OnEnable() { UpdateLeaf(); //存入叶子之前先更新一次叶子数据确保存入无误。实际上前两步也应该在存入前更新一次叶子数据,但前两步因为没有更新干脆把碰撞器当做固定的处理了 QuadtreeWithUpdateObject.SetLeaf(_leaf); }