public void Remove(Collider collider) { if (!ColliderList.Contains(collider)) { return; } /* * foreach (Cell cell in GetCells(collider.WorldTransform)) * { * if (cell.Colliders.Contains(collider)) * { * cell.Colliders.Remove(collider); * } * } */ // OR ForEach((cell) => { if (cell.Colliders.Contains(collider)) { cell.Colliders.Remove(collider); } }); ComputedCollision.Remove(collider); ColliderList.Remove(collider); }
public void Add(Collider collider) { if (ColliderList.Contains(collider)) { return; } foreach (Cell cell in GetCells(collider.WorldTransform)) { cell.Colliders.Add(collider); } ComputedCollision[collider] = new HashSet <Collider>(); ColliderList.Add(collider); }