private static DelayedGameObjectManager GetInstance()
 {
     if (pInstance == null)
     {
         pInstance = new DelayedGameObjectManager();
     }
     return(pInstance);
 }
Esempio n. 2
0
 //-----------------------------------------------------------------------------
 // Game::Update()
 //      Called once per frame, update data, tranformations, etc
 //      Use this function to control process order
 //      Input, AI, Physics, Animation, and Graphics
 //-----------------------------------------------------------------------------
 public override void Update()
 {
     TimerManager.Update(this.GetTime());
     InputManager.Update();
     GameObjectManager.Update();
     CollisionPairManager.Process();
     SoundManager.GetEngine().Update();
     DelayedGameObjectManager.Process();
 }
        public override void Update()
        {
            GameObject pExplosion = GameObjectManager.Find(this.goName);

            if (pExplosion.markedForDeath == false)
            {
                pExplosion.markedForDeath = true;
                RemoveExplosionObserver pObserver = new RemoveExplosionObserver(pExplosion);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
Esempio n. 4
0
        public override void Update()
        {
            GameObject pSplat = GameObjectManager.Find(GameObjectName.Splat);

            if (pSplat.markedForDeath == false)
            {
                pSplat.markedForDeath = true;
                RemoveSplatObserver pObserver = new RemoveSplatObserver(pSplat);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
Esempio n. 5
0
        public override void Update()
        {
            //Debug.WriteLine("RemoveAlienObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);
            GameObject pAlien = this.pSubject.goB;

            if (pAlien.markedForDeath == false)
            {
                pAlien.markedForDeath = true;
                RemoveAlienObserver pObserver = new RemoveAlienObserver(pAlien);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
        public override void Update()
        {
            Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);

            this.pMissile = Missile.GetMissile(this.pSubject.goA, this.pSubject.goB);
            Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile);
            if (pMissile.markedForDeath == false)
            {
                pMissile.markedForDeath = true;
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
Esempio n. 7
0
        public override void Update()
        {
            //Debug.WriteLine("RemoveBrickObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);

            this.pBrick = (ShieldBrick)this.pSubject.goB;
            //Debug.WriteLine("BrickRemoveObserver: --> delete missile {0}", pBrick);
            if (pBrick.markedForDeath == false)
            {
                pBrick.markedForDeath = true;
                RemoveBrickObserver pObserver = new RemoveBrickObserver(this);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
Esempio n. 8
0
        public override void Update()
        {
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);

            //this.pBomb = (Bomb)this.pSubject.goA;
            this.pBomb = Bomb.GetBomb(this.pSubject.goA, this.pSubject.goB);
            Debug.Assert(this.pBomb != null);
            //Debug.WriteLine("BombRemoveObserver: --> delete bomb {0}", pBomb);
            if (pBomb.markedForDeath == false)
            {
                pBomb.markedForDeath = true;
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
        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;
            }
        }
Esempio n. 10
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);
            }
        }