コード例 #1
0
 public void AddScreen(GameScreen screen, InputManager inputManager)
 {
     transition = true; //lets us know we are transitioning
     fade.IsActive = true;
     fade.Alpha = 0.0f; //0 is fully transparent
     fade.ActivateValue = 1.0f; //1 is fully opaque
     fade.Increase = true;
     newScreen = screen; //here in case some other function deletes top screen from stack
     this.inputManager = inputManager;
 }
コード例 #2
0
        public void AddScreen(GameScreen screen, InputManager inputManager, float alpha)
        {
            transition = true; //lets us know we are transitioning
            fade.IsActive = true;
            fade.ActivateValue = 1.0f; //1 is fully opaque
            newScreen = screen; //here in case some other function deletes top screen from stack
            this.inputManager = inputManager;

            if (alpha != 1.0f)
            {
                fade.Alpha = 1.0f - alpha;
            }
            else
            {
                fade.Alpha = alpha;
                fade.Increase = true;
            }
        }
コード例 #3
0
 private void Transition(GameTime gameTime)
 {
     fade.Update(gameTime, ref animation); //increase alpha until it equals 1
     if (fade.Alpha == 1.0f && fade.Timer.TotalSeconds == 1.0f) //put total seconds in here so we don't run more than once
     {
         screenStack.Push(newScreen);
         currentScreen.UnloadContent();
         currentScreen = newScreen;
         currentScreen.LoadContent(content, this.inputManager);
     }
     else if (fade.Alpha == 0.0f)
     {
         transition = false;
         fade.IsActive = false;
     }
 }
コード例 #4
0
 public void Initialize()
 {
     currentScreen = new SplashScreen();
     fade = new FadeAnimation();
     inputManager = new InputManager();
 }