示例#1
0
 public override void Transition()
 {
     SpriteBatchMan.SetActive(this.poSpriteBatchMan);
     GameObjectMan.SetActive(this.poGameObjectMan);
     FontMan.SetActive(this.poFontMan);
     InputMan.SetActive(this.poInputMan);
 }
示例#2
0
        //DoubleCheck this
        public static void Remove(Font pFNode)
        {
            Debug.Assert(pFNode != null);
            FontMan pFMan = FontMan.PrivGetInstance();

            pFMan.BaseRemove(pFNode);
        }
        public override void LoadContent()
        {
            pSpriteBatchMan = new SpriteBatchMan(1, 1);
            TextureMan.Create(2, 1);
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);

            TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");
            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            SpriteBatch pSB_Texts = pSpriteBatchMan.Add(SpriteBatch.Name.Texts);

            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SCORE<1>  HIGH-SCORE  SCORE<2>", Glyph.Name.Consolas36pt, 200, 680);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreOne, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.HighestScore, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 440, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreTwo, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 650, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SPACE INVADERS", Glyph.Name.Consolas36pt, 320, 500);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "Choose 1 or 2 to play...", Glyph.Name.Consolas36pt, 240, 450);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "1, Single Player", Glyph.Name.Consolas36pt, 300, 350);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "2, Two Player", Glyph.Name.Consolas36pt, 310, 250);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKeyOneSubject();
            pInputSubject.Attach(new MoveToPlayingStateObserver());

            pInputSubject = InputMan.GetKeyTwoSubject();
            pInputSubject.Attach(new MoveToPlayingStateObserver());

            Simulation.SetState(Simulation.State.Realtime);
        }
 public override void UnLoadContent()
 {
     pSpriteBatchMan.Destroy();
     TextureMan.Destroy();
     GlyphMan.Destroy();
     FontMan.Destroy();
 }
        public override void LoadContent()
        {
            pSpriteBatchMan = new SpriteBatchMan(1, 1);
            //TimerMan.Create(3, 1);
            TextureMan.Create(2, 1);
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);

            TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");
            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            SpriteBatch pSB_Texts = pSpriteBatchMan.Add(SpriteBatch.Name.Texts);

            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SCORE<1>  HIGH-SCORE  SCORE<2>", Glyph.Name.Consolas36pt, 200, 680);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreOne, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.HighestScore, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 440, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreTwo, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 650, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "GAME OVER!!", Glyph.Name.Consolas36pt, 350, 400);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "Press 3 to go back to the menu...", Glyph.Name.Consolas36pt, 200, 280);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKeyThreeSubject();
            pInputSubject.Attach(new MoveToMenuObserver());

            Simulation.SetState(Simulation.State.Realtime);
            //CycleBackToMenuState pCylce = new CycleBackToMenuState();
            //TimerMan.Add(TimeEvent.Name.CycleBackToMenu, pCylce, 20f);
        }
        public override void Initialize()
        {
            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            this.poFontMan = new FontMan();
            FontMan.SetActive(this.poFontMan);

            this.poInputMan = new InputMan();
            InputMan.SetActive(this.poInputMan);

            SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true);

            HighScore hS = new HighScore();

            Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            Font pFont = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "High Score", Glyph.Name.Consolas36pt, 100, 500);

            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pFont = FontMan.Add(Font.Name.HighScores, SpriteBatch.Name.Texts, hS.GetScore().ToString(), Glyph.Name.Consolas20pt, 100, 400);
            pFont.SetColor(0.40f, 0.40f, 0.40f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Back to Menu", Glyph.Name.Consolas20pt, 100, 100);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            InputSubject pInputSubject = InputMan.GetCursorSubject();

            pInputSubject.Attach(new HighlightHoverTextObserver(pFont));
            pInputSubject = InputMan.GetMouseLeftKeySubject();
            pInputSubject.Attach(new MenuChoiceObserver(pFont));
        }
        public override void Update(float time)
        {
            InputMan.Update();

            SpaceInvaders pSI       = SpaceInvaders.GetInstance();
            Font          pScoreOne = FontMan.Find(Font.Name.ScoreOne);

            Debug.Assert(pScoreOne != null);
            pScoreOne.UpdateMessage("" + pSI.scoreOne);

            Font pScoreTwo = FontMan.Find(Font.Name.ScoreTwo);

            Debug.Assert(pScoreTwo != null);
            pScoreTwo.UpdateMessage("" + pSI.scoreTwo);


            Font pScoreMax = FontMan.Find(Font.Name.HighestScore);

            Debug.Assert(pScoreMax != null);
            pScoreMax.UpdateMessage("" + pSI.scoreHigh);

            //Simulation.Update(time);
            //if (Simulation.GetTimeStep() > 0.0f)
            //{
            //    // Fire off the timer events
            //    TimerMan.Update(Simulation.GetTotalTime());

            //}
        }
示例#8
0
        public static void ChangeSceneInternal(GameObject pGameObject)
        {
            ForwardIterator pFor = new ForwardIterator(pGameObject);

            Component pNode = pFor.First();

            pFor.Next();
            if (pFor.IsDone())
            {
                GameObject pUFORoot = GameObjectMan.Find(GameObject.Name.UFORoot);
                UFO        pUFO     = (UFO)Iterator.GetChild(pUFORoot);
                pUFO.StopSound();

                int mode      = SceneStateGame.GetPlayMode();
                int currLevel = SceneStateGame.GetCurrLevel();

                String pScore1 = Int32.Parse(FontMan.Find(Font.Name.Score1).GetMessage()).ToString().PadLeft(4, '0');
                SceneStateGame.SetScore1(pScore1);

                String pScore2 = Int32.Parse(FontMan.Find(Font.Name.Score2).GetMessage()).ToString().PadLeft(4, '0');
                SceneStateGame.SetScore2(pScore2);

                String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString().PadLeft(4, '0');
                SceneStateGame.SetScoreHigh(pScoreHigh);

                SceneStateGame.SetStay(true);

                int currPlayer = SceneStateGame.GetCurrPlayer();

                if (currLevel == 1)
                {
                    SceneStateGame.SetPlayerLevel(currPlayer, 2);
                    SceneStateGame.SetBaseY(450.0f);
                    SceneStateGame.SetMoveRate(1.0f);
                }
                else
                {
                    SceneStateGame.SetPlayerLevel(currPlayer, 1);
                    SceneStateGame.SetBaseY(600.0f);
                    SceneStateGame.SetMoveRate(1.5f);
                    //no need to change to the next player, when finish level 2, same player, back to level 1
                    //SceneStateGame.SetCurrPlayer(currPlayer == mode ? 1 : 2);
                }

                //currLevel = SceneStateGame.GetCurrLevel();
                //if (currLevel == 1)
                //{
                //    SceneStateGame.SetBaseY(600.0f);
                //    SceneStateGame.SetMoveRate(1.5f);
                //}
                //else
                //{
                //    SceneStateGame.SetBaseY(450.0f);
                //    SceneStateGame.SetMoveRate(1.0f);
                //}

                Scene pScene = SceneMan.GetScene();
                pScene.Unload();
            }
        }
示例#9
0
        public static void Remove(Glyph pNode)
        {
            Debug.Assert(pNode != null);
            FontMan pMan = FontMan.GetInstance();

            pMan.baseRemove(pNode);
        }
示例#10
0
        public static void Destroy()
        {
            // Get the instance
            FontMan pMan = FontMan.GetInstance();

            pMan.baseDestory();
        }
示例#11
0
        public override void Execute()
        {
            Font pTestMessage = FontMan.Find(Font.Name.Life);

            Debug.Assert(pTestMessage != null);
            String life = SceneStateGame.GetPlayerLife(SceneStateGame.GetCurrPlayer()).ToString();

            pTestMessage.UpdateMessage(life);
        }
示例#12
0
        public static void Dump()
        {
            FontMan pMan = FontMan.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ Font Manager ------");
            pMan.baseDump();
        }
示例#13
0
        public static void DumpFonts()
        {
            FontMan pFMan = FontMan.PrivGetInstance();

            Debug.Assert(pFMan != null);

            Debug.WriteLine("------ Fontzee ------");
            pFMan.BaseDumpNodes();
        }
示例#14
0
        private void PrivStatDump()
        {
            FontMan pFMan = FontMan.PrivGetInstance();

            Debug.Assert(pFMan != null);

            Debug.WriteLine("");
            Debug.WriteLine("Font Manager Stats---------------------");
            pFMan.BaseStatDump();
        }
示例#15
0
        public override void Notify()
        {
            String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString();

            SceneStateTract.SetScoreHigh(pScoreHigh);

            Scene pScene = SceneMan.GetScene();

            pScene.Unload();
        }
示例#16
0
        public static Font Find(Font.Name name)
        {
            FontMan pFMan = FontMan.PrivGetInstance();

            pFMan.pRefNode.name = name;

            Font pFontData = (Font)pFMan.BaseFind(pFMan.pRefNode);

            return(pFontData);
        }
示例#17
0
        public override void loadContent(Scene pScene)
        {
            SpriteBatchMan.Add(SpriteBatch.Name.SelectWindowTexts);

            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SCORE<1>", Glyph.Name.Consolas36pt, 20, 1000);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "HI-SCORE", Glyph.Name.Consolas36pt, 370, 1000);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SCORE<2>", Glyph.Name.Consolas36pt, 700, 1000);
            FontMan.Add(Font.Name.ScoreOne, SpriteBatch.Name.SelectWindowTexts, pScene.getScoreOne().ToString("D4"), Glyph.Name.Consolas36pt, 50, 960);
            FontMan.Add(Font.Name.HighestScore, SpriteBatch.Name.SelectWindowTexts, pScene.getHighestScore().ToString("D4"), Glyph.Name.Consolas36pt, 400, 960);
            FontMan.Add(Font.Name.ScoreTwo, SpriteBatch.Name.SelectWindowTexts, pScene.getScoreTwo().ToString("D4"), Glyph.Name.Consolas36pt, 730, 960);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "CREDIT", Glyph.Name.Consolas36pt, 700, 25);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "00", Glyph.Name.Consolas36pt, 830, 25);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SPACE    INVADERS", Glyph.Name.Consolas36pt, 300, 750);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "PUSH <1> OR <2> PLAYERS BUTTON", Glyph.Name.Consolas36pt, 160, 700);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "*SCORE  ADVANCE  TABLE*", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 200 POINTS", Glyph.Name.Consolas36pt, 380, 600);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 30 POINTS", Glyph.Name.Consolas36pt, 380, 550);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 20 POINTS", Glyph.Name.Consolas36pt, 380, 500);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 10 POINTS", Glyph.Name.Consolas36pt, 380, 450);

            SpriteBatch   pSB_StartWindowSprites = SpriteBatchMan.Add(SpriteBatch.Name.StartWindowSprites);
            ShipLifeGroup pStartWindow           = new ShipLifeGroup(GameObject.Name.ShipLifeGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pStartWindow.activateGameSprite(pSB_StartWindowSprites);

            UFO pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 320, 600, true);

            pUFO.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pUFO);

            Squid pSquid = new Squid(GameObject.Name.Squid, GameSprite.Name.Squid, 320, 550);

            pSquid.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pSquid);

            Crab pCrab = new Crab(GameObject.Name.Crab, GameSprite.Name.Crab, 320, 500);

            pCrab.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pCrab);

            Octopus pOctopus = new Octopus(GameObject.Name.Octopus, GameSprite.Name.Octopus, 320, 450);

            pOctopus.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pOctopus);

            GameObjectMan.Attach(pStartWindow);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKey1Subject();
            pInputSubject.attach(new OnePlayerObserver());

            pInputSubject = InputMan.GetKey2Subject();
            pInputSubject.attach(new TwoPlayerObserver());
        }
示例#18
0
        public static Font Find(Font.Name name)
        {
            FontMan pMan = FontMan.GetInstance();

            // Compare functions only compares two Nodes
            pMan.pRefNode.name = name;

            Font pData = (Font)pMan.baseFind(pMan.pRefNode);

            return(pData);
        }
        public void SetHighhScore(int newHighScore)
        {
            if (newHighScore > highScore)
            {
                highScore = newHighScore;
            }

            Font pFont = FontMan.Find(Font.Name.HighScore);

            pFont.UpdateMessage(highScore.ToString("D4"));
        }
示例#20
0
        override public void Unload()
        {
            SpriteBatchMan.Destroy();
            TextureMan.Destroy();
            GlyphMan.Destroy();
            FontMan.Destroy();
            InputMan.Destroy();
            GhostGameObjectMan.Destroy();

            this.Handle();
        }
        public override void UnLoadContent()
        {
            //pSpriteBatchMan.Destroy();
            TextureMan.Destroy();
            GlyphMan.Destroy();
            //TimerMan.Destroy();

            FontMan.Destroy();
            GameObjectMan.Destroy();
            //ColPairMan.Destroy();
            //ShipMan.Destroy();
        }
示例#22
0
        public static void Destroy()
        {
            // Get the instance
            FontMan pMan = FontMan.PrivGetInstance();

#if (TRACK_DESTRUCTOR)
            Debug.WriteLine("--->FontMan.Destroy()");
#endif
            pMan.BaseDestroy();
            pMan.pRefNode     = null;
            FontMan.pInstance = null;
        }
示例#23
0
        public static void Create(int reserveNum = 3, int growth = 1)
        {
            Debug.Assert(reserveNum > 0);
            Debug.Assert(growth > 0);

            Debug.Assert(pInstance == null);

            if (pInstance == null)
            {
                pInstance = new FontMan(reserveNum, growth);
            }
        }
        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
        public override void Execute()
        {
            GameObject pA = (GameObject)this.pUFO;
            GameObject pB = (GameObject)Iterator.GetParent(pA);

            float x = this.pUFO.x;
            float y = this.pUFO.y;

            pA.Remove();

            // Hacks
            if (this.pGameObj is MissileGroup)
            {
                Missile pMissile = (Missile)Iterator.GetChild(this.pGameObj);

                // bug but don't crash please
                if (pMissile == null)
                {
                    return;
                }

                Player pPlayer = pMissile.pPlayer;
                pPlayer.nPoints += this.pUFO.GetPoints();
                Font.Name pFontName = Font.Name.Uninitialized;
                if (pPlayer.n == 1)
                {
                    pFontName = Font.Name.Score1Value;
                }
                if (pPlayer.n == 2)
                {
                    pFontName = Font.Name.Score2Value;
                }
                Font pScore = FontMan.Find(pFontName);
                pScore.Set(pFontName,
                           pPlayer.nPoints.ToString(),
                           Glyph.Name.Consolas20pt,
                           pScore.pFontSprite.x,
                           pScore.pFontSprite.y);
            }

            SoundMan.PlaySound(Sound.Name.InvaderKilled);

            Explosion   explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, y);
            SpriteBatch pSB_UFOs  = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);

            explosion.ActivateGameSprite(pSB_UFOs);
            GameObjectMan.Attach(explosion);
            TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f);
        }
示例#26
0
        //----------------------------------------------------------------------
        // Static methods
        //----------------------------------------------------------------------
        public static void Create(int reserveNum = 3, int reserveGrow = 1)
        {
            // make sure values are ressonable
            Debug.Assert(reserveNum > 0);
            Debug.Assert(reserveGrow > 0);

            // initialize the singleton here
            Debug.Assert(pInstance == null);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new FontMan(reserveNum, reserveGrow);
            }
        }
        public override void UnLoadContent()
        {
            TimerMan.Destroy();
            TextureMan.Destroy();
            ImageMan.Destroy();
            GameSpriteMan.Destroy();
            BoxSpriteMan.Destroy();
            pSpriteBatchMan.Destroy();
            ProxySpriteMan.Destroy();
            GlyphMan.Destroy();

            //GameObjectMan.Destroy();
            ColPairMan.Destroy();
            FontMan.Destroy();
            ShipMan.Destroy();
        }
示例#28
0
        public override void execute()
        {
            //GameObject pA = (GameObject)this.pAlien;

            //GameObject pB = (GameObject)Iterator.GetParent(pA);
            //pA.remove();

            //if (checkParent(pB) == true)
            //{
            //    GameObject pC = (GameObject)Iterator.GetParent(pB);
            //    pB.remove();
            //}

            //pA.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Alien_Explosion));
            //GameObjectMan.Find(GameObject.Name.ExplosionGroup).add(pA);
            //SpriteBatchMan.Find(SpriteBatch.Name.Explosions).attach(pA.getProxySprite());
            //pA.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes));

            GameSprite pGameSprite = this.pAlien.getProxySprite().getGameSprite();
            Scene      pScene      = SceneMan.GetScene();

            if (pGameSprite.getName() == GameSprite.Name.Squid)
            {
                pScene.addScoreOne(30);
            }
            else if (pGameSprite.getName() == GameSprite.Name.Crab)
            {
                pScene.addScoreOne(20);
            }
            else if (pGameSprite.getName() == GameSprite.Name.Octopus)
            {
                pScene.addScoreOne(10);
            }

            FontMan.Find(Font.Name.ScoreOne).updateMessage(pScene.getScoreOne().ToString("D4"));

            if (pScene.getScoreOne() > pScene.getHighestScore())
            {
                pScene.setHighstScore(pScene.getScoreOne());
                FontMan.Find(Font.Name.HighestScore).updateMessage(pScene.getHighestScore().ToString("D4"));
            }

            this.pAlien.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Alien_Explosion));
            ExplosionEvent pExplosionEvent = new ExplosionEvent(this.pAlien);

            TimerMan.Add(TimeEvent.Name.ExplosionEvent, pExplosionEvent, 0.1f);
        }
        public override void Initialize()
        {
            this.name = SceneContext.Scene.Over;

            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            SpriteBatch pSB_Texts = this.poSpriteBatchMan.Add(SpriteBatch.Name.Texts, 100);

            Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            Font pFont = FontMan.Add(Font.Name.GameOver, SpriteBatch.Name.Texts, "GAME OVER", Glyph.Name.Consolas36pt, 310, 350);

            pFont.SetColor(1.0f, 0.0f, 0.0f);
        }
示例#30
0
        public override void Update()
        {
            SpaceInvaders pGame = GameMan.GetGame();

            pGame.sndEngine.Update();

            InputManager.Update();

            Simulation.Update(pGame.GetTime());

            if (Simulation.GetTimeStep() > 0.0f)
            {
                //start timer
                TimerMan.Update(Simulation.GetTotalTime());

                //Update all the game objects(nodes)
                GONodeMan.Update();

                //check for collisions
                ColPairMan.Process();

                //process observers
                DelayedObjectMan.Process();
            }


            //---------------------------------------------------------------------------------------------------------
            // Font Practice
            //---------------------------------------------------------------------------------------------------------

            Font pScoreMessage = FontMan.Find(Font.Name.P1Points);

            Debug.Assert(pScoreMessage != null);
            pScoreMessage.UpdateMessage("" + (PlayerMan.GetP1Score()));

            Font pHiScore = FontMan.Find(Font.Name.HiPoints);

            Debug.Assert(pHiScore != null);
            pHiScore.UpdateMessage("" + PlayerMan.GetHiScore());

            Font pP1LivesLeft = FontMan.Find(Font.Name.LivesP1);

            Debug.Assert(pP1LivesLeft != null);
            pP1LivesLeft.UpdateMessage("P1 Lives: " + (PlayerMan.GetP1Lives()));
        }