Пример #1
0
    public void OnObjectMoved(GameObject go)
    {
        QuadTreeCell quadTreeCell = null;

        if (!this.m_ObjCellMap.TryGetValue(go, out quadTreeCell))
        {
            return;
        }
        QuadTreeCell cellAtPos = this.GetCellAtPos(go.transform.position);

        if (quadTreeCell != cellAtPos)
        {
            quadTreeCell.RemoveObject(go);
            this.InsertObject(go, false);
        }
    }
Пример #2
0
    public void RemoveObject(GameObject go)
    {
        if (!this.m_ObjCellMap.ContainsKey(go))
        {
            DebugUtils.Assert("[QuadTree:RemoveObject] Tree does not contains object - " + go.name, true, DebugUtils.AssertType.Info);
            return;
        }
        QuadTreeCell quadTreeCell = null;

        if (this.m_ObjCellMap.TryGetValue(go, out quadTreeCell))
        {
            quadTreeCell.RemoveObject(go);
            this.m_ObjCellMap.Remove(go);
            return;
        }
        DebugUtils.Assert(false, true);
    }