/// <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) { // Question related variables initialization float SecondsPassed = (float)gameTime.ElapsedGameTime.TotalSeconds; totalGameTime = gameTime.TotalGameTime.Seconds; particleEffect.Update(SecondsPassed); // Game Logic if (intervalPerQuestionUp(gameTime)) { generateGameSet(); } if (questionIsCorrect && intervalBtwQuestionUp(gameTime)) { textAnimator.Stop(); generateGameSet(); } if (intervalPerGameRoundUp(gameTime)) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); } textAnimator.updateTweener(gameTime); } }
void enterMenuEntrySelected(object sender, PlayerIndexEventArgs e) { if (ScreenManager.CurrentShipChoosing == 1) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new CharacterMenuScreen()); ScreenManager.CurrentShipChoosing = 2; } else if (ScreenManager.CurrentShipChoosing == 2) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen()); ScreenManager.CurrentShipChoosing = 1; ScreenManager.MainMenu.Stop(AudioStopOptions.Immediate); } SetMenuEntryText(); }
/// <summary> /// Lets the game respond to player input. Unlike the Update method, /// this will only be called when the gameplay screen is active. /// </summary> public override void HandleInput(GameTime gameTime, InputState input) { PlayerIndex player; foreach (GestureSample gesture in input.Gestures) { // If we have a tap if (gesture.GestureType == GestureType.Tap) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new PhoneMainMenuScreen()); } } if (backToMenu.Evaluate(input, ControllingPlayer, out player)) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new PhoneMainMenuScreen()); } }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to quit" message box. This uses the loading screen to /// transition from the game back to the main menu screen. /// </summary> void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); }
/// <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()); }
/// <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()); }
public void backButtonSelected(object sender, PlayerIndexEventArgs e) { ScreenManager.ScreenInCounter = 0; LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); }
/// <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(); } } } }
/// <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()); }
void CreditsMenuEntrySelected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new CreditsMenuScreen()); ScreenManager.ScreenInCounter = 4; }
/// <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; }
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()); }