public override void Init() { Input.On(Control.Start, NavigateToMainMenu); Input.On(Control.Select, NavigateToMainMenu); AddClickable(new ScreenClickable(NavigateToMainMenu)); Sound.SoundEffect("SFX/logo-rumble.mp3").Play(); var anim1 = new ScreenFade { Duration = TimeSpan.FromSeconds(3.4), FromAlpha = 255, ToAlpha = 0 }; var anim2 = new ScreenFade { Duration = TimeSpan.FromSeconds(1), FromAlpha = 0, ToAlpha = 0 }; var anim3 = new ScreenFade { Duration = TimeSpan.FromSeconds(1), FromAlpha = 0, ToAlpha = 255 }; Add(new UiImage { Image = "Images/Logo/oilsplash", Transform = new Transform2(new Size2(1.0.VW(), 1.0.VH())) }); Add(anim1); Add(anim2); Add(anim3); anim1.Start(() => anim2.Start(() => anim3.Start(NavigateToMainMenu))); }
public override void Init() { Input.On(Control.Start, NavigateToMainMenu); Input.On(Control.Select, NavigateToMainMenu); Add(new ScreenClickable(NavigateToMainMenu)); var anim1 = new ScreenFade { Duration = TimeSpan.FromSeconds(3.4), FromAlpha = 255, ToAlpha = 0 }; var anim2 = new ScreenFade { Duration = TimeSpan.FromSeconds(1), FromAlpha = 0, ToAlpha = 0 }; var anim3 = new ScreenFade { Duration = TimeSpan.FromSeconds(1), FromAlpha = 0, ToAlpha = 255 }; Add(new CenteredRawImage(_logoImage)); Add(anim1); Add(anim2); Add(anim3); anim1.Start(() => anim2.Start(() => anim3.Start(NavigateToMainMenu))); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here base.Update(gameTime); Globals.UpdateGlobals(); if (screenFade.Active) { screenFade.Update(); } if (Globals.Gamestate == Globals.MENU) { if (screenFade.Active && inMenu) { Reset(); } paused = false; if (startBtn.CheckButton() && !screenFade.Active) { screenFade.Start(Globals.BET, 1f); inMenu = false; } maxVel = 0; foreach (Animal animal in animals) { animal.Update(); if (animal.Vel > maxVel) { maxVel = animal.Vel; } } if (FinishLine >= 800) { ScrollLine += maxVel; FinishLine -= maxVel; if (FinishLine <= 6200) { scrollBg.Update(maxVel); } } } else if (Globals.Gamestate == Globals.BET) { if (screenFade.Active && currentBet == 0) { Reset(); } for (int i = 0; i < betButtons.Count; i++) { if (betButtons[i].CheckButton() && animals[i].Bet < 1 && currentBet < 3) { if (currentBet == 0) { animals[i].Bet = 1; } else if (currentBet == 1) { animals[i].Bet = 2; } else { animals[i].Bet = 3; } currentBet++; bets.Add(i); } } if (currentBet >= 3) { if (startBtn.CheckButton() && !screenFade.Active) { screenFade.Start(Globals.GAMEPLAY, 1f); } } } else { if (!screenFade.Active) { maxVel = 0; if (places.Count == 0) { if (startBtn.CheckButton()) { screenFade.Start(Globals.MENU, 1f); inMenu = true; } } if (paused) { if (pauseTimer.Check()) { paused = false; } else { pauseTimer.Update(); } } else { foreach (Animal animal in animals) { animal.Update(); if (animal.Vel > maxVel) { maxVel = animal.Vel; } } if (FinishLine >= 800) { ScrollLine += maxVel; FinishLine -= maxVel; if (FinishLine <= 6200) { scrollBg.Update(maxVel); } } } } } }