Exemple #1
0
 override public void Notify(float xCurs, float yCurs)
 {
     if (ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1)))
     {
         SceneContext.SetState(SceneContext.Scene.Select);
     }
 }
 override public void Notify(float xCurs, float yCurs)
 {
     if (ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1)))
     {
         SceneContext.SetState(SceneContext.Scene.Aliens);
         SoundMan.PlaySound(Sound.Name.Shoot);
     }
 }
Exemple #3
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()
        {
            // Add your update below this line: ----------------------------
            //  stuff called every update no matter the scene here...
            //  example: like audio update


            GlobalTimer.Update(this.GetTime());

            // Hack to proof of concept...
            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_0) == true)
            {
                pSceneContext.SetState(SceneContext.Scene.Demo);
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_3) == true)
            {
                pSceneContext.SetState(SceneContext.Scene.Select);
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_1) == true)
            {
                pSceneContext.SetState(SceneContext.Scene.Play);
                Score.SetCurrentPlayer(1);
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_2) == true)
            {
                pSceneContext.SetState(SceneContext.Scene.Play);
                Score.SetCurrentPlayer(2);
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_4) == true)
            {
                pSceneContext.SetState(SceneContext.Scene.GameOver);
            }



            // Update the scene
            (pSceneContext.GetState()).Update(this.GetTime());
        }
Exemple #4
0
        public override void Notify()
        {
            SceneContext pSceneContext = SceneContext.GetInstance();

            Debug.Assert(pSceneContext != null);

            SceneState sceneState = pSceneContext.GetState();

            if (pSceneContext.poScenePlayer2.numLives > 1)
            {
                pSceneContext.SetState(SceneContext.Scene.Player2);
            }
        }
Exemple #5
0
        public override void Notify()
        {
            SceneContext pSceneContext = SceneContext.GetInstance();

            Debug.Assert(pSceneContext != null);

            SceneState sceneState = pSceneContext.GetState();

            if (sceneState.name == SceneContext.Scene.Over)
            {
                pSceneContext.SetState(SceneContext.Scene.Select);
            }
        }
Exemple #6
0
 public override void Notify()
 {
     this.pAlienGrid = (AlienGrid)this.pSubject.pObjA;
     PlayerMan.WriteHighScores();
     SceneContext.SetState(SceneContext.Scene.Over);
 }
        public override void Execute()
        {
            GameObject pA = (GameObject)this.pAlien;
            GameObject pB = (GameObject)Iterator.GetParent(pA);

            float x = this.pAlien.x;
            float y = this.pAlien.y;

            AlienGrid pGrid = (AlienGrid)this.pAlien.pParent.pParent;

            pGrid.nNumActive--;

            pA.Remove();

            // TODO: Need a better way...
            if (privCheckParent(pB) == true)
            {
                GameObject pC = (GameObject)Iterator.GetParent(pB);
                pB.Remove();

                if (privCheckParent(pC) == true)
                {
                    pC.Remove();
                }
            }

            Missile pMissile = (Missile)this.pGameObj;
            Player  pPlayer  = pMissile.pPlayer;

            //
            Font.Name pFontName = Font.Name.Uninitialized;
            if (this.pGameObj is MissileCategory)
            {
                pPlayer.nPoints += this.pAlien.GetPoints();
                Font pScore = null;
                if (pPlayer.n == 1)
                {
                    pScore    = FontMan.Find(Font.Name.Score1Value);
                    pFontName = Font.Name.Score1Value;
                }
                if (pPlayer.n == 2)
                {
                    pScore    = FontMan.Find(Font.Name.Score2Value);
                    pFontName = Font.Name.Score2Value;
                }
                pScore.Set(pFontName,
                           pPlayer.nPoints.ToString(),
                           Glyph.Name.Consolas20pt,
                           pScore.pFontSprite.x,
                           pScore.pFontSprite.y);
            }

            //---------------------------------------------------------------------------------------------------------
            // Sound
            //---------------------------------------------------------------------------------------------------------
            SoundMan.PlaySound(Sound.Name.InvaderKilled);
            TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound);

            pTimeEvent.deltaTime -= 0.01f;

            //---------------------------------------------------------------------------------------------------------
            // Explosion
            //---------------------------------------------------------------------------------------------------------
            Explosion   explosion  = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, 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);

            //---------------------------------------------------------------------------------------------------------
            // Scene Transition
            //---------------------------------------------------------------------------------------------------------
            if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 1)
            {
                PlayerMan.WriteHighScores();
                pPlayer.nCurrLevel++;
                SceneContext.GetState().Initialize();
                if (SceneContext.bMultiplayer)
                {
                    SceneContext.SetState(SceneContext.Scene.MultiPlay);
                }
                else
                {
                    SceneContext.SetState(SceneContext.Scene.SinglePlay);
                }
            }
            else if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 2)
            {
                PlayerMan.WriteHighScores();
                SceneContext.SetState(SceneContext.Scene.Credits);
            }
        }