Ejemplo n.º 1
0
        //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);
            }
        }