private void Transition(GameTime gameTime) { fade.Update(gameTime, ref animation); if (animation.Alpha == 1.0 && fade.Timer.TotalSeconds == 1.0f) { screenStack.Push(newScreen); currentScreen.UnloadContent(); currentScreen = newScreen; currentScreen.LoadContent(content, inputManager); Console.WriteLine("Transition has finished"); } else if (animation.Alpha == 0.0f) { transition = false; animation.IsActive = false; } }
public override void Update(GameTime gameTime) { inputManager.Update(); if (imageNumber >= animations.Count || inputManager.KeyPressed(Keys.Escape)) { ScreenManager.Instance.AddScreen(new TitleScreen(), inputManager); } else { Animation anim = animations[imageNumber]; fade.Update(gameTime, ref anim); animations[imageNumber] = anim; Console.WriteLine(imageNumber + " " + animations.Count); if (animations[imageNumber].Alpha == 0.0f) { imageNumber++; fade = new FadeAnimation(); } } }
public void Update(GameTime gameTime, InputManager inputManager) { if (axis == 1) { if (inputManager.KeyPressed(Keys.Right)) { itemNumber++; } if (inputManager.KeyPressed(Keys.Left)) { itemNumber--; } } else { if (inputManager.KeyPressed(Keys.Down)) { itemNumber++; } if (inputManager.KeyPressed(Keys.Up)) { itemNumber--; } } if (inputManager.KeyDown(Keys.Enter)) { if (linkType[itemNumber] == "Screen") { Type newClass = Type.GetType("Game4." + linkID[itemNumber]); ScreenManager.Instance.AddScreen((GameScreen)Activator.CreateInstance(newClass), inputManager); } if (linkType[itemNumber] == "Action") { if (linkID[itemNumber] == "Quit") { Game1.exit = true; } } } if (itemNumber < 0) { itemNumber = 0; } else if (itemNumber >= menuItems.Count) { itemNumber = menuItems.Count - 1; } for (int i = 0; i < animation.Count; i++) { Animation a = animation[i]; for (int j = 0; j < animationTypes.Count; j++) { if (itemNumber == i) { animation[i].IsActive = true; } else { animation[i].IsActive = false; } switch (animationTypes[j]) { case "Fade": fadeAnimation.Update(gameTime, ref a); break; case "SSheet": ssAnimation.Update(gameTime, ref a); break; } } animation[i] = a; } }