static public void Process() { DelayedObjectManager pDelayMan = DelayedObjectManager.GetInstance(); CollisionObserver pNode = pDelayMan.head; while (pNode != null) { // Fire off listener pNode.Execute(); pNode = (CollisionObserver)pNode.pNext; } // remove pNode = pDelayMan.head; CollisionObserver pTmp = null; while (pNode != null) { pTmp = pNode; pNode = (CollisionObserver)pNode.pNext; // remove pDelayMan.Detach(pTmp, ref pDelayMan.head); } }
static public void Attach(CollisionObserver observer) { // protection Debug.Assert(observer != null); DelayedObjectManager pDelayMan = DelayedObjectManager.GetInstance(); // add to front if (pDelayMan.head == null) { pDelayMan.head = observer; observer.pNext = null; observer.pPrev = null; } else { observer.pNext = pDelayMan.head; observer.pPrev = null; pDelayMan.head.pPrev = observer; pDelayMan.head = observer; } }