Beispiel #1
0
        /// <summary>
        ///     Allows the screen to run logic, such as updating the transition
        ///     position. Unlike HandleInput, this method is called regardless of
        ///     whether the screen is active, hidden, or in the middle of a
        ///     transition.
        /// </summary>
        public virtual void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            this.otherScreenHasFocus = otherScreenHasFocus;

            if (isExiting)
            {
                // If the screen is going away to die, it should transition off.
                screenState = EScreenState.TransitionOff;

                if (!UpdateTransition(gameTime, transitionOffTime, 1))
                {
                    // When the transition finishes, remove the screen.
                    ScreenManager.RemoveScreen(this);
                }
            }
            else if (coveredByOtherScreen)
            {
                // If the screen is covered by another, it should transition off.
                screenState = UpdateTransition(gameTime, transitionOffTime, 1)
                                                      ? EScreenState.TransitionOff
                                                      : EScreenState.Hidden;
            }
            else
            {
                // Otherwise the screen should transition on and become active.
                screenState = UpdateTransition(gameTime, transitionOnTime, -1)
                                                      ? EScreenState.TransitionOn
                                                      : EScreenState.Active;
            }
        }
Beispiel #2
0
        public virtual void Update(GameTime gameTime)
        {
            if (mInitialized == false)
            {
                Initialize();
            }

            mScreenState = EScreenState.Active;
        }
 // Use this for initialization
 void Start()
 {
     if (CGame.Singleton.winState == CGame.EWinState.HighscoreBeaten)
     {
         gameOverPage.SetActive(false);
         inputHighscore.SetActive(true);
         state = EScreenState.Highscore;
     }
     else if (CGame.Singleton.winState == CGame.EWinState.Win)
     {
         gameOverPage.SetActive(true);
         inputHighscore.SetActive(false);
         secondaryGameOverText.text = "You got out!";
         state = EScreenState.GameOver;
     }
     else // CGame.Singleton.winState == CGame.EWinState.Lose
     {
         gameOverPage.SetActive(true);
         inputHighscore.SetActive(false);
         secondaryGameOverText.text = "She got you!";
         state = EScreenState.GameOver;
     }
 }
Beispiel #4
0
		/// <summary>
		///     Allows the screen to run logic, such as updating the transition
		///     position. Unlike HandleInput, this method is called regardless of
		///     whether the screen is active, hidden, or in the middle of a
		///     transition.
		/// </summary>
		public virtual void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) {
			this.otherScreenHasFocus = otherScreenHasFocus;

			if (isExiting) {
				// If the screen is going away to die, it should transition off.
				screenState = EScreenState.TransitionOff;

				if (!UpdateTransition(gameTime, transitionOffTime, 1)) {
					// When the transition finishes, remove the screen.
					ScreenManager.RemoveScreen(this);
				}
			} else if (coveredByOtherScreen) {
				// If the screen is covered by another, it should transition off.
				screenState = UpdateTransition(gameTime, transitionOffTime, 1)
					              ? EScreenState.TransitionOff
					              : EScreenState.Hidden;
			} else {
				// Otherwise the screen should transition on and become active.
				screenState = UpdateTransition(gameTime, transitionOnTime, -1)
					              ? EScreenState.TransitionOn
					              : EScreenState.Active;
			}
		}