コード例 #1
0
ファイル: Game.cs プロジェクト: stevemoxley/ConsoleLife
 private static void RemoveEntities()
 {
     foreach (var entity in _deleteWaitList)
     {
         AllEntities.Remove(entity);
     }
     _deleteWaitList.Clear();
 }
コード例 #2
0
ファイル: MinHeapMap.cs プロジェクト: jacobkurien1/Algorithms
        /// <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);
        }
コード例 #3
0
ファイル: EntityShared.cs プロジェクト: cmostuor/ForTheWin
 /// <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);
 }