示例#1
0
 public void Remove(HCell cell)
 {
     foreach (KeyValuePair <int, LinkedList <HCell> > entry in Cells)
     {
         if (entry.Value.Remove(cell))
         {
             break;
         }
     }
 }
示例#2
0
        public void Add(HCell cell)
        {
            int   level;
            AABB  aabb = cell.Collider.ComputeAABB();
            float size = 10, width = (float)(aabb.Max.X - aabb.Min.X);

            for (level = 0; size * 1 < width; level++)
            {
                size *= 2;
            }

            Debug.Assert(level >= MAX_LEVEL, "The collider is too big. It cannot be contain in this hgrid");

            if (Cells.TryGetValue(level, out LinkedList <HCell> value))
            {
                value.AddLast(cell);
                Cells.Add(level, value);
                OccupiedLevelMask |= (1 << level);
            }
        }