Ejemplo n.º 1
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()));
        }
Ejemplo n.º 2
0
        public override void Update()
        {
            //first time through set a time to change states
            if (this.bStateToggle == true)
            {
                //inititally used the game to get time
                //Testing timer man
                //could use Timer Man for current time
                float curTime = TimerMan.GetCurrentTime();
                this.ChangeStateTime = curTime + 10;
                this.bStateToggle    = false;
            }


            else
            {
                SpaceInvaders pGame = GameMan.GetGame();

                //time has elapsed start over
                if (this.ChangeStateTime <= pGame.GetTime())
                {
                    this.bStateToggle = true;

                    SpriteBatch pSB_Intro = SpriteBatchMan.Find(SpriteBatch.Name.IntroScreen);
                    pSB_Intro.bToggle = true;

                    SpriteBatch pGameOverScreen = SpriteBatchMan.Find(SpriteBatch.Name.GameOver);
                    pGameOverScreen.bToggle = false;

                    //SpriteBatch pSB_Splats = SpriteBatchMan.Find(SpriteBatch.Name.Splats);
                    //pSB_Splats.bToggle = false;

                    //----------------------------------------------------------------------------------------------------
                    //Things we need to reset for the Next game?
                    //----------------------------------------------------------------------------------------------------

                    // need to remove ship from its root
                    GameObject pShipRoot = GONodeMan.Find(GameObject.Name.ShipRoot);
                    GameObject pShip     = (GameObject)pShipRoot.GetFirstChild();

                    if (pShip != null)
                    {
                        pShip.Remove();
                    }

                    ShipMan.Destroy();

                    GraveyardMan.KillAll();
                    //GraveyardMan.DumpNodes();
                    GraveyardMan.Destroy();


                    TimerMan.ClearActiveList();
                    TimerMan.DumpTimeEvents();

                    AlienGroup pAlienGroup = (AlienGroup)GONodeMan.Find(GameObject.Name.AlienGrid);
                    pAlienGroup.SetDeltaMove(15.0f);

                    SpriteBatch pSB_Projectiles = SpriteBatchMan.Find(SpriteBatch.Name.Projectiles);
                    pSB_Projectiles.bToggle = false;

                    //----------------------------------------------------------------------------------------------------

                    pGame.SetGameState(GameMan.State.Intro);
                    pGame.GetCurrentState().Update();
                }
            }
        }