public override void Update(GameTime gameTime) { inputManager.Update(); Animation a = animation[imageNumber]; FAnimation.Update(gameTime, ref a); animation[imageNumber] = a; if (animation[imageNumber].Alpha == 0.0f) { imageNumber++; } if (imageNumber >= animation.Count - 1 || inputManager.KeyPressed(Keys.Z)) { imageNumber = animation.Count - 1; if (animation[imageNumber].Alpha != 1.0f) { ScreenManager.Instance.AddScreen(new TitleScreen(), animation[imageNumber].Alpha, inputManager); } else { ScreenManager.Instance.AddScreen(new TitleScreen(), inputManager); } } }
private void Transition(GameTime gameTime) { fade.Update(gameTime, ref animation); if (animation.Alpha == 1.0f && fade.Timer.TotalSeconds == 1.0f) { screenStack.Push(newScreen); currentScreen.UnloadContent(); currentScreen = newScreen; currentScreen.LoadContent(content, this.inputManager); animation.IsActive = true; } else if (animation.Alpha == 0.0f) { transition = false; animation.IsActive = false; } }
public void Update(GameTime gameTime, InputManager inputManager) { if (axis == 1) { if (inputManager.KeyPressed(Keys.Right, Keys.D)) { itemNumber++; } else if (inputManager.KeyPressed(Keys.Left, Keys.A)) { itemNumber--; } } else { if (inputManager.KeyPressed(Keys.Up, Keys.W)) { itemNumber--; } else if (inputManager.KeyPressed(Keys.Down, Keys.S)) { itemNumber++; } } if (inputManager.KeyPressed(Keys.Enter, Keys.Z)) { if (linkType[itemNumber] == "Screen") { Type newClass = Type.GetType("XNAPlatformer." + linkID[itemNumber]); ScreenManager.Instance.AddScreen((GameScreen)Activator.CreateInstance(newClass), inputManager); } } if (itemNumber < 0) { itemNumber = 0; } else if (itemNumber > menuItems.Count - 1) { itemNumber = menuItems.Count - 1; } for (int i = 0; i < animation.Count; i++) { for (int j = 0; j < animationTypes.Count; j++) { if (itemNumber == i) { animation[i].IsActive = true; } else { animation[i].IsActive = false; } Animation a = animation[i]; switch (animationTypes[j]) { case "Fade": fAnimation.Update(gameTime, ref a); break; case "SpriteSheet": ssAnimation.Update(gameTime, ref a); break; } animation[i] = a; } } }