public void Process()
        {
            CollisionObserver pNode = this.head;

            while (pNode != null)
            {
                // Fire off listener
                pNode.ExecuteDelayed();

                pNode = (CollisionObserver)pNode.GetNext();
            }


            // remove
            pNode = this.head;
            CollisionObserver pTmp = null;

            while (pNode != null)
            {
                pTmp  = pNode;
                pNode = (CollisionObserver)pNode.GetNext();

                // remove
                this.PrivDetach(pTmp, ref this.head);
            }
        }
示例#2
0
        static public void Process()
        {
            DelayedObjectMan pDelayMan = DelayedObjectMan.PrivGetInstance();

            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.PrivDetach(pTmp, ref pDelayMan.head);
            }
        }
示例#3
0
        public void NotifyObservers()
        {
            CollisionObserver curr = this.pObservers;

            while (curr != null)
            {
                curr.Update();
                curr = (CollisionObserver)curr.pONext;
            }
        }
示例#4
0
        public void notify()
        {
            CollisionObserver pNode = this.pHead;

            while (pNode != null)
            {
                pNode.notify();

                pNode = (CollisionObserver)pNode.pNext;
            }
        }
        public void Notify()
        {
            CollisionObserver pNode = this.pHead;

            while (pNode != null)
            {
                // Fire off listener
                pNode.Notify();

                pNode = (CollisionObserver)pNode.pNext;
            }
        }
        public void notify()
        {
            CollisionObserver colObserver = this.observerRoot;

            Debug.Assert(colObserver != null);

            while (colObserver != null)
            {
                colObserver.notify();
                colObserver = (CollisionObserver)colObserver.pNext;
            }
        }
示例#7
0
 public void addObserver(CollisionObserver colObserver)
 {
     if (headObservers == null)
     {
         headObservers = new ObserverData(colObserver);
     }
     else
     {
         OLink temp = new ObserverData(colObserver);
         temp.next     = headObservers;
         headObservers = temp;
     }
 }
        public void attachObserver(CollisionObserver mObserver)
        {
            Debug.Assert(mObserver != null);

            if (observerRoot == null)
            {
                observerRoot       = mObserver;
                observerRoot.pPrev = null;
                observerRoot.pNext = null;
            }
            else
            {
                mObserver.pNext    = observerRoot;
                observerRoot.pPrev = observerRoot;
                observerRoot       = mObserver;
            }
        }
示例#9
0
        public void RegisterObserver(CollisionObserver observer)
        {
            Debug.Assert(observer != null);
            observer.pSubject = this;

            if (this.pObservers == null)
            {
                this.pObservers = observer;
                observer.pONext = null;
                observer.pOPrev = null;
            }
            else
            {
                observer.pONext        = pObservers;
                this.pObservers.pOPrev = observer;
                this.pObservers        = observer;
            }
        }
        private void Detach(CollisionObserver observer, ref CollisionObserver coNode)
        {
            Debug.Assert(observer != null);

            if (observer.pOPrev != null)
            {
                observer.pOPrev.pONext = observer.pONext;
            }
            else
            {
                coNode = (CollisionObserver)observer.pONext;
            }

            if (observer.pONext != null)
            {
                observer.pONext.pOPrev = observer.pOPrev;
            }
        }
示例#11
0
        private void PrivDetach(CollisionObserver node, ref CollisionObserver head)
        {
            // protection
            Debug.Assert(node != null);

            if (node.pPrev != null)
            {   // middle or last node
                node.pPrev.pNext = node.pNext;
            }
            else
            {  // first
                head = (CollisionObserver)node.pNext;
            }

            if (node.pNext != null)
            {   // middle node
                node.pNext.pPrev = node.pPrev;
            }
        }
        private void PrivDetach(CollisionObserver node, ref CollisionObserver head)
        {
            // protection
            Debug.Assert(node != null);

            if (node.GetPrev() != null)
            {   // middle or last node
                node.GetPrev().SetNext(node.GetNext());
            }
            else
            {  // first
                head = (CollisionObserver)node.GetNext();
            }

            if (node.GetNext() != null)
            {   // middle node
                node.GetNext().SetPrev(node.GetPrev());
            }
        }
        public static void Attach(CollisionObserver observer)
        {
            Debug.Assert(observer != null);
            DelayedGameObjectManager delayedGOMan = DelayedGameObjectManager.GetInstance();

            if (delayedGOMan.collisionObservers == null)
            {
                delayedGOMan.collisionObservers = observer;
                observer.pONext = null;
                observer.pOPrev = null;
            }
            else
            {
                observer.pONext = delayedGOMan.collisionObservers;
                observer.pOPrev = null;
                delayedGOMan.collisionObservers.pOPrev = observer;
                delayedGOMan.collisionObservers        = observer;
            }
        }
示例#14
0
        //-------------------------------------------------------------------------------
        // Methods
        //-------------------------------------------------------------------------------
        public void attach(CollisionObserver observer)
        {
            Debug.Assert(observer != null);
            observer.pSubject = this;

            // add to front
            if (pHead == null)
            {
                pHead          = observer;
                observer.pNext = null;
                observer.pPrev = null;
            }
            else
            {
                observer.pNext = pHead;
                pHead.pPrev    = observer;
                pHead          = observer;
            }
        }
        public void Attach(CollisionObserver observer)
        {
            // protection
            Debug.Assert(observer != null);

            // add to front
            if (this.head == null)
            {
                this.head = observer;
                observer.SetNext(null);
                observer.SetPrev(null);
            }
            else
            {
                observer.SetNext(this.head);
                observer.SetPrev(null);
                this.head.SetPrev(observer);
                this.head = observer;
            }
        }
        public static void Process()
        {
            DelayedGameObjectManager delayedGOMan = DelayedGameObjectManager.GetInstance();
            CollisionObserver        observer     = delayedGOMan.collisionObservers;

            while (observer != null)
            {
                observer.Execute();
                observer = (CollisionObserver)observer.pONext;
            }
            observer = delayedGOMan.collisionObservers;
            CollisionObserver obs = null;

            while (observer != null)
            {
                obs      = observer;
                observer = (CollisionObserver)observer.pONext;
                delayedGOMan.Detach(obs, ref delayedGOMan.collisionObservers);
            }
        }
示例#17
0
        public void Attach(CollisionObserver observer)
        {
            // protection
            Debug.Assert(observer != null);

            observer.pSubject = this;

            // add to front
            if (pHead == null)
            {
                pHead = observer;
                observer.SetNext(null);
                observer.SetPrev(null);
            }
            else
            {
                observer.SetNext(pHead);
                pHead.SetPrev(observer);
                pHead = observer;
            }
        }
示例#18
0
        //---------------------------------------------------------------------------------------------------------
        // Static methods
        //---------------------------------------------------------------------------------------------------------
        static public void Attach(CollisionObserver observer)
        {
            // protection
            Debug.Assert(observer != null);

            DelayedObjectMan pDelayMan = DelayedObjectMan.PrivGetInstance();

            // 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;
            }
        }
示例#19
0
 public void Attach(CollisionObserver observer)
 {
     this.pSubject.Attach(observer);
 }
 public CollisionSubject()
 {
     gameObjA     = null;
     gameObjB     = null;
     observerRoot = null;
 }
 private DelayedGameObjectManager()
 {
     this.collisionObservers = null;
 }
示例#22
0
 public void RemoveObserver(CollisionObserver observer)
 {
     throw new NotImplementedException();
 }
 public DelayedObjectManager()
 {
     this.head = null;
 }
示例#24
0
 public CollisionSubject()
 {
     this.pObservers = null;
     this.goA        = null;
     this.goB        = null;
 }
示例#25
0
 public ObserverData(CollisionObserver collisionObserver)
 {
     this.collisionObserver = collisionObserver;
 }
 private DelayedObjectManager()
 {
     this.head = null;
 }
 public CollisionSubject()
 {
     this.pObjB = null;
     this.pObjA = null;
     this.pHead = null;
 }
示例#28
0
 public void attach(CollisionObserver observer)
 {
     this.poSubject.attach(observer);
 }
 public void attach(CollisionObserver observer)
 {
     //Differently done
     observer.setColSubject(colSubject);
     this.colSubject.attachObserver(observer);
 }