/// <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 //If the player clicks the logo at the end screen, open up browser to hyperlink if (Mouse.GetState().LeftButton == ButtonState.Pressed && !clicked && gameOver) { if (Mouse.GetState().Position.X <= windowWitdh - 20 && Mouse.GetState().Position.X >= windowWitdh - statisticLinkText.Width - 20) { if (Mouse.GetState().Position.Y <= Window.ClientBounds.Height - 20 && Mouse.GetState().Position.Y >= Window.ClientBounds.Height - statisticLinkText.Height - 20) { try { Process.Start("https://www.prosa.dk/raadgivning/loenstatistik/"); } catch { } } } clicked = true; } else if (Mouse.GetState().LeftButton == ButtonState.Released) { clicked = false; } //Calls update for the stuff that only need to update during the preparing phase if (isPreparing) { union.Update(gameTime); colleague.Update(gameTime); noTrick.Update(gameTime); } //Calls update for the stuff that only need to update during the negotiating phase if (!isPreparing && !gameOver) { Player.Instance.Update(gameTime); Negotiator.Instance.Update(gameTime); } base.Update(gameTime); }
/// <summary> /// Used to Update the variables in the Player class /// </summary> /// <param name="gameTime">From the monogame framework, counts the time</param> public override void Update(GameTime gameTime) { for (int i = 0; i < stateArray.Length; i++) { if (stateArray[i] != null) { stateArray[i].Update(gameTime); } } if (!GameWorld.isPreparing && negotiatingTrick != null) { negotiatingTrick.Update(gameTime); } base.Update(gameTime); }