Example #1
0
        public override void Notify()
        {
            GameObject pObject = this.pSubject.pObjB;

            Debug.Assert(pObject != null);

            GameSprite pUFOSplat = GameSpriteMan.Find(GameSprite.Name.UFOsplat);

            //future concept
            //pObject.GetProxy().SetRealSprite(this.pSprite);


            //get the locations and render the image
            pUFOSplat.PosX(pObject.x);
            pUFOSplat.PosY(pObject.y);
            pUFOSplat.Update();

            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);


            pSB_Aliens.Attach(pUFOSplat);


            TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pUFOSplat, pSB_Aliens), 0.5f);
        }
        public override void Notify()
        {
            //when this notify is called we swap the images and draw it to the alien spritebatch
            //then maybe add a time event that..... removes it somehow... remove from spritebatch after a half second

            GameObject pObject = this.pSubject.pObjB;

            Debug.Assert(pObject != null);

            GameSprite pShipSplat = GameSpriteMan.Find(GameSprite.Name.ShipSplat);

            //future concept
            //pObject.GetProxy().SetRealSprite(this.pSprite);


            //get the locations and render the image
            //I'm really upset about this........ but here we are creating a new
            pShipSplat.PosX(pObject.x);
            pShipSplat.PosY(pObject.y);
            pShipSplat.Update();

            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);

            pSB_Aliens.Attach(pShipSplat);

            TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pShipSplat, pSB_Aliens), 0.5f);
        }
Example #3
0
        public void UpdateAllActive()
        {
            GameSprite current = (GameSprite)this.poActiveHead;

            while (current != null)
            {
                current.Update();
                current = (GameSprite)(current.pNext);
            }
        }
        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();
            }
        }