Пример #1
0
        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;
            }
        }
Пример #2
0
        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);
            }
        }