Esempio n. 1
0
 /// <summary>
 /// The "Exit" button handler uses the LoadingScreen to take the user out to the main menu.
 /// </summary>
 void exitButton_Tapped(object sender, EventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                        new PhoneMainMenuScreen());
 }
Esempio n. 2
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
            {
                pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
            }
            else
            {
                pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);
            }

            if (IsActive) // indicates whether this screen is front most, ie: active
            {
                //Duplicate and store game time to allow other functions to acccess the game time var.
                gameTimeManager.GameTime = gameTime;

                // Question related variables initialization
                float SecondsPassed = (float)gameTime.ElapsedGameTime.TotalSeconds;
                particleEffect.Update(SecondsPassed);

                // Update Interactive elements.
                textAnim_GameOver.updateTweener(gameTime);
                textAnim_GoodJob.updateTweener(gameTime);


                if (gameTimeManager.intervalPerQuestionUp(gameTime))
                {
                    generateGameSet();
                    gameTimeManager.restartQuestionTimeCounter();
                }

                // Check whether Question is correct first before processing gameTimeManager
                if (questionIsCorrect && gameTimeManager.intervalBtwQuestionUp(gameTime))
                {
                    textAnim_GoodJob.Stop();
                    generateGameSet();
                    gameTimeManager.restartQuestionTimeCounter();
                }


                // Each Game has only a fixed time
                if (gameTimeManager.intervalPerGameRoundUp(gameTime))
                {
                    textAnim_GameOver.Start();

                    if (gameTimeManager.pause(gameTime, 6)) // pause to display textAnim to allow user to read.
                    {
                        textAnim_GameOver.Stop();

                        // For now we would indicate that the game is up by simply going back to the main menu.
                        LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                           new MainMenuScreen());

                        // Explicitly Reset score, due to singleton property.
                        GameScoringSystem.Instance.resetScore();
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Event handler for when the Play Game menu entry is selected.
 /// </summary>
 void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                        new GameplayScreen());
 }
Esempio n. 4
0
 /// <summary>
 /// The "Resume" button handler just calls the OnCancel method so that
 /// pressing the "Resume" button is the same as pressing the hardware back button.
 /// </summary>
 void retryButton_Tapped(object sender, EventArgs e)
 {
     ScreenManager.engineSoundBool = true;
     LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new GameplayScreen());
     ExitScreen();
 }
 void creditsButton_Tapped(object sender, EventArgs e)
 {
     ScreenManager.enableMainMenuAd = false;
     LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new CreditsScreen());
 }
Esempio n. 6
0
 void CreditsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                        new CreditsMenuScreen());
     ScreenManager.ScreenInCounter = 4;
 }
Esempio n. 7
0
 /// <summary>
 /// Event handler for when the Play Game menu entry is selected.
 /// </summary>
 void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                        new CharacterMenuScreen());
     ScreenManager.ScreenInCounter = 1;
 }
Esempio n. 8
0
 void playButton_Tapped(object sender, EventArgs e)
 {
     // When the "Play" button is tapped, we load the GameplayScreen
     LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new GameplayScreen());
 }
 /// <summary>
 /// Event handler for when the Play Game menu entry is selected.
 /// </summary>
 void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                        new BlackholeBattle.BlackholeBattle());
 }