public void Update() { if (networkView.isMine) { ServerNotifier.Address = Relay.Instance.AddressFinder.ExternalAddress; ServerNotifier.CurrentMapName = Application.loadedLevelName; ServerNotifier.NumberOfPlayers = PlayerPresence.UnsafeAllPlayerPresences.Count; // In case our external address is still null, Update() in the // ServerNotifier won't actually send to the list server, so it's // fine to call it here. (It will send as soon as our address is not // null). ServerNotifier.Update(); } Leaderboard.Update(); // Update banner messages float yAccum = 0f; for (int i = BannerMessages.Count - 1; i >= 0; i--) { //BannerMessages[i].Index = displayIndex; BannerMessages[i].IndexY = yAccum; BannerMessages[i].Update(); if (BannerMessages[i].Active) { yAccum += BannerMessages[i].CalculatedHeight + 1f; } if (BannerMessages[i].Finished) { BannerMessages.RemoveAt(i); } } }
// Update is called once per frame void Update() { if (leaderboard.Root.gameObject.activeSelf) { leaderboard.Update(); } else { score += Time.deltaTime * scoreRate; uiscore.text = "Score: " + (ulong)score; } }
private void Dead(PaintEventArgs e) { Controls.Clear(); Invalidate(); var image = bitmaps["YouDead"]; e.Graphics.DrawImage(image, new Point(0, 0)); var name = "Stephan"; if (InputBox("Игра окончена", "Введите Ваше имя:", ref name) == DialogResult.OK) { leaders.Update(name, game.Player.Gold); } }
/// <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) { // TODO: Add your update logic here // Updates keyboard and mouse states Globals.UpdateGlobals(); // If there is a fade active, no other update code is run // If the game is paused, no other update code is run and there is a check to see if the player has left it. If the help screen is open, it runs that logic. // Otherwise, it runs the logic for the current mode. if (Globals.Fade.Active) { Globals.Fade.Update(); } else if (paused) { // Checks if the player unpauses, or if they press the menu button if (Globals.CheckKey(Keys.Escape)) { paused = false; } else if (menuBtn.CheckButton()) { Globals.Fade.Start(Globals.MENU, 1); paused = false; } } else if (Globals.HelpScreenOpen) { HelpScreen.Update(); } else { switch (Globals.Gamestate) { case Globals.LOGO: { // Once the logo has lasted for its entire duration, the fade to the menu begins if (logoDuration.CheckCooldown()) { Globals.Fade.Start(Globals.MENU, 1); } else { logoDuration.UpdateCooldown(); } break; } case Globals.TRANSITION: { TransitionScreen.Update(); break; } case Globals.MENU: { Menu.Update(); break; } case Globals.GAMEPLAY: { // Checks if the player has paused if (Globals.CheckKey(Keys.Escape)) { paused = true; } // Updates the game that is currently running switch (Globals.Minigame) { case Globals.LUCKY_DAY: { luckyDay.Update(); break; } case Globals.COLOR_GUESSER: { colorGuesser.Update(); break; } case Globals.RAINDROPS: { raindrops.Update(); break; } case Globals.JUGGLER: { juggler.Update(); break; } case Globals.TERMINAL_VELOCITY: { terminalVelocity.Update(); break; } case Globals.BACKWARDS: { backwards.Update(); break; } case Globals.TYPEWRITER: { typewriter.Update(); break; } case Globals.FLOOR_IS_LAVA: { floorIsLava.Update(); break; } case Globals.MILKSHAKER: { milkshaker.Update(); break; } case Globals.CIRCLE_CLICKER: { circleClicker.Update(); break; } } break; } case Globals.LEADERBOARD: { Leaderboard.Update(); break; } case Globals.RESULTS: { Results.Update(); break; } } } base.Update(gameTime); }