Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public override void Transition()
 {
     SpriteBatchMan.SetActive(this.poSpriteBatchMan);
     GameObjectMan.SetActive(this.poGameObjectMan);
     FontMan.SetActive(this.poFontMan);
     InputMan.SetActive(this.poInputMan);
 }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
        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 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 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());

            //}
        }
Ejemplo n.º 7
0
        public static InputSubject GetMouseRightKeySubject()
        {
            InputMan pMan = InputMan.privGetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectRightMouseKey);
        }
Ejemplo n.º 8
0
 override public void Update(float systemTime)
 {
     //Font pTestMessage = FontMan.Find(Font.Name.TitleString);
     //Debug.Assert(pTestMessage != null);
     //pTestMessage.UpdateMessage("dog " + count++);
     GameObjectMan.Update();
     InputMan.Update();
 }
Ejemplo n.º 9
0
        public static InputSubject GetKeyEnterSubject()
        {
            InputMan pMan = InputMan.GetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectKeyEnter);
        }
Ejemplo n.º 10
0
        public static InputSubject GetSpaceSubject()
        {
            InputMan pMan = InputMan.GetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectSpace);
        }
Ejemplo n.º 11
0
        public static InputSubject GetKey_Q_Subject()
        {
            InputMan pMan = InputMan.privGetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectKey_Q);
        }
Ejemplo n.º 12
0
        public static InputSubject GetArrowLeftSubject()
        {
            InputMan pMan = InputMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectArrowLeft);
        }
Ejemplo n.º 13
0
        public static InputSubject GetKeyThreeSubject()
        {
            InputMan pMan = InputMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectThree);
        }
Ejemplo n.º 14
0
        public static InputSubject GetSlashSubject()
        {
            InputMan pMan = InputMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            return(pMan.pSubjectSlash);
        }
Ejemplo n.º 15
0
 public override void unLoadContent(Scene pScene)
 {
     InputMan.Reset();
     //SpriteBatchMan.Find(SpriteBatch.Name.SelectWindowTexts).setIsDraw(false);
     SpriteBatchMan.Reset();
     GameObjectMan.Reset();
     //SpriteBatchMan.Find(SpriteBatch.Name.SelectWindowTexts).deepClear();
     //SpriteBatchMan.Remove(SpriteBatchMan.Find(SpriteBatch.Name.SelectWindowTexts));
 }
Ejemplo n.º 16
0
 private static InputMan privGetInstance()
 {
     if (pInstance == null)
     {
         pInstance = new InputMan();
     }
     Debug.Assert(pInstance != null);
     return(pInstance);
 }
Ejemplo n.º 17
0
        private static InputMan GetInstance()
        {
            if (_InputMan == null)
            {
                _InputMan = new InputMan();
            }

            return(_InputMan);
        }
Ejemplo n.º 18
0
        public static void SetActive(InputMan pInputMan)
        {
            InputMan pMan = InputMan.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pInputMan != null);
            InputMan.pInstance = pInputMan;
        }
Ejemplo n.º 19
0
        private static InputMan privGetInstance()
        {
            if (pMan == null)
            {
                pMan = new InputMan();
            }
            Debug.Assert(pMan != null);

            return(pMan);
        }
Ejemplo n.º 20
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());
        }
Ejemplo n.º 21
0
        //public static InputObserver MoveRight()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pRight;
        //}

        //public static InputObserver MoveLeft()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pLeft;
        //}

        //public static InputObserver Shoot()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pSpace;
        //}

        //public static InputObserver ToggleBox()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pBoxKey;
        //}
        //public static InputObserver OnePlayer()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pOnePlayer;
        //}
        //public static InputObserver TwoPlayer()
        //{
        //    InputMan pMan = InputMan.privGetInstance();
        //    Debug.Assert(pMan != null);

        //    return pMan.pTwoPlayer;
        //}
        public static void Update()
        {
            InputMan pMan = InputMan.privGetInstance();

            Debug.Assert(pMan != null);

            // SpaceKey: (with key history) -----------------------------------------------------------
            bool spaceKeyCurr = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_SPACE);

            if (spaceKeyCurr == true && pMan.spaceIsPressed == false)
            {
                pMan.pSpace.Notify();
            }

            pMan.spaceIsPressed = spaceKeyCurr;
            // LeftKey: (no history) -----------------------------------------------------------
            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_LEFT) == true)
            {
                pMan.pLeft.Notify();
            }

            // RightKey: (no history) -----------------------------------------------------------
            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_RIGHT) == true)
            {
                pMan.pRight.Notify();
            }

            bool p1 = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_1);

            if (p1 == true && pMan.oneIsPressed == false)
            {
                pMan.pOnePlayer.Notify();
            }

            pMan.oneIsPressed = p1;

            bool p2 = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_2);

            if (p2 == true && pMan.twoIsPressed == false)
            {
                pMan.pTwoPlayer.Notify();
            }

            pMan.twoIsPressed = p2;

            bool pBox = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_T);

            if (pBox == true && pMan.boxIsPressed == false)
            {
                pMan.pBoxKey.Notify();
            }

            pMan.boxIsPressed = pBox;
        }
Ejemplo n.º 22
0
        override public void Unload()
        {
            SpriteBatchMan.Destroy();
            TextureMan.Destroy();
            GlyphMan.Destroy();
            FontMan.Destroy();
            InputMan.Destroy();
            GhostGameObjectMan.Destroy();

            this.Handle();
        }
Ejemplo n.º 23
0
 public override void unLoadContent(Scene pScene)
 {
     GameObjectMan.Reset();
     TimerMan.Reset();
     InputMan.Reset();
     CollisionPairMan.Reset();
     SpriteBatchMan.Reset();
     BoxSpriteMan.Reset();
     ProxySpriteMan.Reset();
     UFOMan.Reset();
     ShipMan.Reset();
 }
Ejemplo n.º 24
0
        public override void Update(float systemTime)
        {
            // Input
            InputMan.Update();

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

            string updatedScore = (SceneContext.highScore).ToString("D4");

            this.pFontHighScore.UpdateMessage(updatedScore);
        }
Ejemplo n.º 25
0
        public override void Update(float systemTime)
        {
            InputMan.Update();

            TimerMan.Update(systemTime);

            ColPairMan.Process();

            GameObjectMan.Update();

            DelayedObjectMan.Process();
        }
        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();
            }
        }
Ejemplo n.º 27
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();
        }
Ejemplo n.º 28
0
        public static void Reset()
        {
            InputMan pMan = InputMan.GetInstance();

            Debug.Assert(pMan != null);

            pMan.pSubjectArrowLeft  = new InputSubject();
            pMan.pSubjectArrowRight = new InputSubject();
            pMan.pSubjectSpace      = new InputSubject();
            pMan.pSubjectT          = new InputSubject();
            pMan.pSubjectKey1       = new InputSubject();
            pMan.pSubjectKey2       = new InputSubject();
            pMan.pSubjectKeyEnter   = new InputSubject();
        }
Ejemplo n.º 29
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();
        }
Ejemplo n.º 30
0
        public static void Update()
        {
            InputMan pMan = InputMan.privGetInstance();

            Debug.Assert(pMan != null);

            bool spaceKeyCurr = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_SPACE);

            if (spaceKeyCurr == true && pMan.privSpaceKeyPrev == false)
            {
                pMan.pSubjectSpace.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_LEFT) == true)
            {
                pMan.pSubjectArrowLeft.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_RIGHT) == true)
            {
                pMan.pSubjectArrowRight.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_B) == true)
            {
                pMan.pSubjectKey_B.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_1) == true)
            {
                pMan.pSubjectKey_1.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_2) == true)
            {
                pMan.pSubjectKey_2.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_Q) == true)
            {
                pMan.pSubjectKey_Q.Notify();
            }

            pMan.privSpaceKeyPrev = spaceKeyCurr;
        }