コード例 #1
0
        public override void Notify()
        {
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }

            if (this.pSubject.pObjB is WallBottom)
            {
                //---------------------------------------------------------------------------------------------------------
                // Explosion
                //---------------------------------------------------------------------------------------------------------
                Explosion   explosion  = new Explosion(GameObject.Name.Explosion_Ground, GameSprite.Name.Explosion_Ground, this.pBomb.x, this.pBomb.y);
                SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);
                explosion.ActivateGameSprite(pSB_Aliens);
                GameObjectMan.Attach(explosion);
                TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f);
            }
        }
コード例 #2
0
        public override void Notify()
        {
            // Delete missile
            Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            // At this point we have two game objects
            // Actually we can control the objects in the visitor
            // Alphabetical ordering... A is missile,  B is wall

            // This cast will throw an exception if I'm wrong
            this.pMissile = (Missile)this.pSubject.pObjA;

            Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile);


            if (pMissile.bMarkForDeath == false)
            {
                pMissile.bMarkForDeath = true;

                // Delay - remove object later
                // ToDo - reduce the new functions
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #3
0
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            // At this point we have two game objects
            // Actually we can control the objects in the visitor
            // Alphabetical ordering... A is missile,  B is wall

            // This cast will throw an exception if I'm wrong
            this.pMissile = (Missile)this.pSubject.pObjA;

            //Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile);


            if (pMissile.bMarkForDeath == false)
            {
                pMissile.bMarkForDeath = true;

                // Delay - remove object later
                // ToDo - reduce the new functions
                //AnimationSprite pAnimUFODies = new AnimationSprite(GameSprite.Name.Missile);

                //pAnimUFODies.Attach(Image.Name.MissileBombDies);

                //TimerMan.Add(TimerEvent.Name.SquidAnimation, pAnimUFODies, 0.00f, false);

                RemoveMissileObserver pObserver = new RemoveMissileObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        public override void Notify()
        {
            //Double-check to verify the different visitor pattern
            this.pUFO  = (UFO)this.pSubject.pObjA;
            this.pWall = (WallCategory)this.pSubject.pObjB;
            Debug.Assert(this.pUFO != null);

            if (pUFO.bMarkForDeath == false)
            {
                pUFO.bMarkForDeath = true;

                //this is to eliminate some of the checks that the UFORoot
                //does with the wall while it generates another UFO
                UFORoot pUFORoot = (UFORoot)GONodeMan.Find(GameObject.Name.UFORoot);
                Debug.Assert(pUFORoot != null);

                pUFORoot.x = -100;
                pUFORoot.y = -100;
                pUFORoot.SetDeltaMove(-1.0f);


                MissedUFOobserver pObserver = new MissedUFOobserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #7
0
        override public void Update(float systemTime)
        {
            // Snd update - keeps everything moving and updating smoothly
            sndEngine.Update();

            // Single Step, Free running...
            Simulation.Update(systemTime);

            // Input
            InputMan.Update();

            // Run based on simulation stepping
            if (Simulation.GetTimeStep() > 0.0f)
            {
                // Fire off the timer events
                TimerMan.Update(Simulation.GetTotalTime());

                // walk through all objects and push to flyweight
                GameObjectMan.Update();

                // Do the collision checks
                ColPairMan.Process();

                // Delete any objects here...
                DelayedObjectMan.Process();
            }
        }
コード例 #8
0
        public override void Notify()
        {
            GameObject pObject = this.pSubject.pObjA;

            this.pShip = (Ship)this.pSubject.pObjB;
            Debug.Assert(pShip != null);

            if (pShip.bMarkForDeath == false)
            {
                this.pShip.bMarkForDeath = true;

                //had initially tried to use the reference "this" ship
                //did not work FYI, needed to get the ship from manager
                Ship pShip = ShipMan.GetShip();

                pShip.SetShootState(ShipMan.ShootState.End);
                pShip.SetMoveState(ShipMan.MoveState.NoMove);


                HitShipObserver pObserver = new HitShipObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }

            //very wierd not sure how i feel about it
            if (pObject.GetName() == GameObject.Name.Octopus || pObject.GetName() == GameObject.Name.Squid || pObject.GetName() == GameObject.Name.Crab)
            {
                //we want to reset the grids location
                AlienGroup pGrid = (AlienGroup)GONodeMan.Find(GameObject.Name.AlienGrid);
                pGrid.MoveUp();
            }
        }
コード例 #9
0
        public static void SetActive(DelayedObjectMan pSBMan)
        {
            DelayedObjectMan pMan = DelayedObjectMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pSBMan != null);
            DelayedObjectMan.pActiveDOMan = pSBMan;
        }
コード例 #10
0
        private static DelayedObjectMan PrivGetInstance()
        {
            if (instance == null)
            {
                instance = new DelayedObjectMan();
            }

            Debug.Assert(instance != null);

            return(instance);
        }
コード例 #11
0
        public static void Create()
        {
            // initialize the singleton here
            Debug.Assert(instance == null);

            // Do the initialization
            if (instance == null)
            {
                instance = new DelayedObjectMan();
            }
        }
コード例 #12
0
        public override void Notify()
        {
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #13
0
        public override void Notify()
        {
            this.pAlien = (AlienCategory)this.pSubject.pObjB;

            if (pAlien.bMarkForDeath == false)
            {
                this.IncreaseHorizontalMoveRange();
                pAlien.bMarkForDeath = true;
                GridRemoveAlienObserver pObserver = new GridRemoveAlienObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #14
0
        public override void Update(float systemTime)
        {
            InputMan.Update();

            TimerMan.Update(systemTime);

            ColPairMan.Process();

            GameObjectMan.Update();

            DelayedObjectMan.Process();
        }
コード例 #15
0
        private static DelayedObjectMan PrivGetInstance()
        {
            // Do the initialization
            if (instance == null)
            {
                instance = new DelayedObjectMan();
            }

            // Safety - this forces users to call create first
            Debug.Assert(instance != null);

            return(instance);
        }
コード例 #16
0
        public override void Notify()
        {
            this.pBrick = (ShieldBrick)this.pSubject.pObjB;
            Debug.Assert(this.pBrick != null);

            if (pBrick.bMarkForDeath == false)
            {
                pBrick.bMarkForDeath = true;
                //   Delay
                RemoveBrickObserver pObserver = new RemoveBrickObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #17
0
        public override void Notify()
        {   //delete bomb
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #18
0
        public override void Notify()
        {
            this.pMissile = (Missile)this.pSubject.pObjA;
            Debug.Assert(this.pMissile != null);

            if (pMissile.bMarkForDeath == false)
            {
                pMissile.bMarkForDeath = true;
                //   Delay
                RemoveMissileObserver pObserver = new RemoveMissileObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #19
0
        public override void Notify()
        {
            this.pUFO = (UFO)this.pSubject.pObjB;
            Debug.Assert(this.pUFO != null);

            if (pUFO.bMarkForDeath == false)
            {
                pUFO.bMarkForDeath = true;
                //   Delay
                RemoveUFOObserver2 pObserver = new RemoveUFOObserver2(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #20
0
        public override void notify()
        {
            this.pBomb = this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                BombExplosionObsever pObserver = new BombExplosionObsever(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #21
0
        public override void Update(float systemTime)
        {
            // Input
            InputMan.Update();

            // Do the collision checks
            ColPairMan.Process();

            // walk through all objects and push to flyweight
            GameObjectMan.Update();

            // Delete any objects here...
            DelayedObjectMan.Process();
        }
コード例 #22
0
        //----------------------------------------------------------------------
        // Override abstract class
        //----------------------------------------------------------------------
        public override void notify()
        {
            this.pShip = (Ship)this.pSubject.pObjB;
            Debug.Assert(this.pShip != null);

            if (pShip.bMarkForDeath == false)
            {
                pShip.bMarkForDeath = true;

                // Delay
                RemoveShipObserver pObserver = new RemoveShipObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #23
0
        public override void Notify()
        {
            this.pGameObj = (GameObject)this.pSubject.pObjA;
            this.pAlien   = (AlienCategory)this.pSubject.pObjB;
            Debug.Assert(this.pAlien != null);

            if (pAlien.bMarkForDeath == false)
            {
                pAlien.bMarkForDeath = true;
                //   Delay
                RemoveAlienObserver pObserver = new RemoveAlienObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #24
0
        public override void Update(float time)
        {
            // Add your update below this line: ----------------------------
            //in order to render the ship on screen
            pShip.Update();

            //Update the player 1 score
            Font pScoreOne = FontMan.Find(Font.Name.ScoreOne);

            Debug.Assert(pScoreOne != null);
            SpaceInvaders pSI = SpaceInvaders.GetInstance();

            pScoreOne.UpdateMessage("" + pSI.scoreOne);

            //update the player lives
            Font pLives = FontMan.Find(Font.Name.PlayerLives);

            Debug.Assert(pLives != null);
            pLives.UpdateMessage("X" + playLives);

            // Snd update - keeps everything moving and updating smoothly
            SpaceInvaders.GetInstance().sndEngine.Update();

            // Single Step, Free running...
            Simulation.Update(time);

            // Input
            InputMan.Update();

            if (Iterator.GetChild(pUFOGroup) != null)
            {
                SpaceInvaders.GetInstance().sndEngine.Play2D("ufo_highpitch.wav");
            }

            // Run based on simulation stepping
            if (Simulation.GetTimeStep() > 0.0f)
            {
                // Fire off the timer events
                TimerMan.Update(Simulation.GetTotalTime());

                // Do the collision checks
                ColPairMan.Process();

                // walk through all objects and push to flyweight
                GameObjectMan.Update();

                // Delete any objects here...
                DelayedObjectMan.Process();
            }
        }
コード例 #25
0
        //---------------------------------------------------------------------------------------------------------
        // Override abstract method
        //---------------------------------------------------------------------------------------------------------
        public override void notify()
        {
            //Debug.WriteLine("RemoveAlien_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            this.pUFO = this.pSubject.pObjA;
            Debug.Assert(this.pUFO != null);

            if (pUFO.bMarkForDeath == false)
            {
                pUFO.bMarkForDeath = true;
                //   Delay
                UFOExplosionObserver pObserver = new UFOExplosionObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #26
0
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #27
0
        //public override void Transition()
        //{
        //    // update SpriteBatchMan()
        //    SpriteBatchMan.SetActive(this.poSpriteBatchMan);
        //}

        public override void Entering()
        {
            // update SpriteBatchMan()
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);
            GameObjectMan.SetActive(this.poGameObjectMan);
            TimerMan.SetActive(this.poTimerMan);
            ShipMan.SetActive(this.poShipMan);
            DelayedObjectMan.SetActive(this.poDelayedObjectMan);

            // Update timer since last pause
            float t0    = GlobalTimer.GetTime();
            float t1    = this.TimeAtPause;
            float delta = t0 - t1;

            TimerMan.PauseUpdate(delta);
        }
コード例 #28
0
        public override void update(Scene pScene, float currTime)
        {
            // Add your update below this line: ----------------------------
            SoundMan.Update();

            InputMan.Update();

            TimerMan.Update(currTime);
            GameObjectMan.Update();

            // check collision
            CollisionPairMan.Process();

            // Delete any objects here...
            DelayedObjectMan.Process();
        }
コード例 #29
0
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("RemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            this.pMissile = (Missile)this.pSubject.pObjA;
            Debug.Assert(this.pMissile != null);

            if (pMissile.bMarkForDeath == false)
            {
                pMissile.bMarkForDeath = true;
                //   Delay
                RemoveMissileObserver pObserver = new RemoveMissileObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
コード例 #30
0
        public override void Notify()
        {
            // Remove MissileObserver ObjectA is missile,
            this.pMissile = (Missile)this.pSubject.pObjA;
            Debug.Assert(this.pMissile != null);


            if (pMissile.bMarkForDeath == false)
            {
                pMissile.bMarkForDeath = true;


                //pass missile reference to manager thats executes/removes objects later
                RemoveMissileObserver pObserver = new RemoveMissileObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }