static public void Process() { DelayedObjectMan pDelayMan = DelayedObjectMan.PrivGetInstance(); ColObserver pNode = pDelayMan.head; while (pNode != null) { // Fire off listener pNode.Execute(); pNode = (ColObserver)pNode.pNext; } // remove pNode = pDelayMan.head; ColObserver pTmp = null; while (pNode != null) { pTmp = pNode; pNode = (ColObserver)pNode.pNext; // remove pDelayMan.PrivDetach(pTmp, ref pDelayMan.head); } }
static public void Process() { DelayedObjectMan pDelayMan = DelayedObjectMan.PrivGetInstance(); ColObserver pNode = pDelayMan.head; while (pNode != null) { pNode.Execute(); pNode = (ColObserver)pNode.pNext; } pNode = pDelayMan.head; ColObserver pTemp = null; while (pNode != null) { pTemp = pNode; pNode = (ColObserver)pNode.pNext; //this might have been my issue with my timermanager references pDelayMan.PrivDetach(pTemp, ref pDelayMan.head); } }
//process any observers in the update loop of main game static public void Process() { //get the manager instance DelayedObjectManager pDelayMan = DelayedObjectManager.privGetInstance(); //First - Fire off all the observers currently on the list //get the head observer ColObserver pNode = pDelayMan.pHeadColObserver; //iterate through the observer list while (pNode != null) { // Fire off listener pNode.Execute(); //get the next observer pNode = (ColObserver)pNode.pMNext; } //done executing all observers - now remove them pNode = pDelayMan.pHeadColObserver; ColObserver pTmp = null; //iterate through the observer list while (pNode != null) { //hold current observer in pTmp for reference after removal pTmp = pNode; pNode = (ColObserver)pNode.pMNext; // remove observer pDelayMan.privDetach(pTmp, ref pDelayMan.pHeadColObserver); } }