T[] GetCollisionObjectsFromAChild(Vector2 checkPoint, float checkRadius, QuadtreeWithUpdate <T> child)
 {
     if (child._field.PointToFieldDistance(checkPoint) <= _maxRadius + checkRadius)      //这里不光要考虑到检测半径,还要考虑到节点最大半径
     {
         return(child.CheckCollision(checkPoint, checkRadius));
     }
     return(new T[0]);
 }
    void Split()
    {
        Debug.Log("位置在" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + "的树梢节点达到分割条件,进行分割");

        Update();       //这一步非常重要!隐形巨坑!有时候有的叶子已经脱离了他所在的树梢的范围但还没有更新,在分割完成后重新存入叶子的时候就会发生错误,在分割前先进行一次更新,因为只有自己的叶子要重新存入,所以自己调用更新自己就行,不需要根节点进行全部更新

        float xCenter = (_field.left + _field.right) / 2;
        float yCenter = (_field.bottom + _field.top) / 2;

        _upperRightChild = new QuadtreeWithUpdate <T>(_field.top, _field.right, yCenter, xCenter, _maxLeafsNumber, _minSideLength, _root, this);
        _lowerRightChild = new QuadtreeWithUpdate <T>(yCenter, _field.right, _field.bottom, xCenter, _maxLeafsNumber, _minSideLength, _root, this);
        _lowerLeftChild  = new QuadtreeWithUpdate <T>(yCenter, xCenter, _field.bottom, _field.left, _maxLeafsNumber, _minSideLength, _root, this);
        _upperLeftChild  = new QuadtreeWithUpdate <T>(_field.top, xCenter, yCenter, _field.left, _maxLeafsNumber, _minSideLength, _root, this);

        foreach (QuadtreeWithUpdateLeaf <T> leaf in _leafs)
        {
            SetLeafToChildren(leaf);
        }
        _leafs = null;
    }
    //构造,构造方法增加根节点参数,如果不传参则设为自身(只有创建根节点时不传参)
    public QuadtreeWithUpdate(float top, float right, float bottom, float left, int maxLeafNumber, float minSideLength, QuadtreeWithUpdate <T> root = null, QuadtreeWithUpdate <T> parent = null)
    {
        _field = new QuadtreeWithUpdateField(top, right, bottom, left);

        _maxLeafsNumber = maxLeafNumber;
        _minSideLength  = minSideLength;

        _root = root != null ? root : this;

        /*
         *   ? : 运算符,英文冒号(:)是运算符的一部分。
         *  ? :运算符是唯一的三参数运算符(暂时的,但几十年都没有出第二个),所以很多人直接叫他“三目运算符”
         *  他的格式是这样的:
         *  条件 ? 参数1 : 参数2
         *  如果条件为真,返回参数1,条件为假,返回参数2。
         *
         *  特别方便,本来要if else四行的代码只要一行就搞定了
         */

        _parent = parent;
    }
 private void Awake()
 {
     _quadtree = new QuadtreeWithUpdate <GameObject>(_top, _right, _bottom, _left, _maxLeafsNumber, _minSideLength);
 }