private static void RemoveEntities() { foreach (var entity in _deleteWaitList) { AllEntities.Remove(entity); } _deleteWaitList.Clear(); }
/// <summary> /// this would get the min value and delete the value from the heap. /// /// The running time for this operation is O(logn) /// </summary> /// <returns></returns> public T ExtractMin() { if (_currentNumberOfElements == 0) { throw new Exception("The heap is empty"); } T retVal = _arrayToStoreTree[0]; Swap(0, _currentNumberOfElements - 1); _arrayToStoreTree[_currentNumberOfElements - 1] = default(T); AllEntities.Remove(retVal.Id); AllEntitiesIndex.Remove(retVal.Id); _currentNumberOfElements--; MinHeapify(0); return(retVal); }
/// <summary> /// Schedules this entity for deletion at the end of the current frame. /// Until then, its IsDeleted property will be true. /// </summary> public virtual void Delete() { IsDeleted = true; AllEntities.Remove(this); }