public void Update(GameTime gameTime) { background.Update(gameTime); HelpButton.Update(gameTime); ExitButton.Update(gameTime); SettingsButton.Update(gameTime); if (GameScreenManager.Instance.ClientID != -1) { User usr = RetroEnvironment.GetGame().GetClientManager().GetClientByUserID(GameScreenManager.Instance.ClientID).GetUser(); if (usr != null) { txtDiamond.SetText(usr.GetDiamonds()); txtCredit.SetText(usr.GetCredits()); txtDucket.SetText(usr.GetDuckets()); } } }
public void Update(GameTime GT, MouseState MS, KeyboardState KS, bool IsActive) { //int i = 1; //foreach (var b in Tiles) //{ // b.Position.Y = Utils.generateOffset(i++, i++, 0.45f, 0.8f) * 2; //} Utils.waveTime += GameSceneVariables.WaveFactor / 10; updateKeys(GT); if (ButtonStatus.DraggedButton == null && ButtonStatus.PreviouslyDraggedButton == null && ButtonStatus.ClickedButton == null && Selector == null && IsActive) { if (MS.LeftButton == ButtonState.Pressed) { Cam.Rotate(Utils.Map( ((MS.X - PreviousMouseState.X) + (PreviousMouseState.X - PreviousMouseState2.X)) / 2, -200, 200, -1, 1 ), false); } else if (MS.LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed) { SpeedInterpolation = Utils.Map( ((MS.X - PreviousMouseState.X) + (PreviousMouseState.X - PreviousMouseState2.X)) / 2, -300, 300, -1, 1 ); Interpolation = (int)MathHelper.Clamp((150f * SpeedInterpolation), -100, 100); } } else if (Selector != null) { Selector.Location = MS.Position.ToVector2(); Selector.Update(); if (PreviousMouseState.LeftButton == ButtonState.Pressed && MS.LeftButton == ButtonState.Released) { CurrentColorUnderMouse = Utils.getColorAt(SelectionBackBuffer, MS.X, MS.Y); foreach (var b in Tiles) { if (b.Terrain.ID == CurrentColorUnderMouse) { Selector.Entity.Position = b.GenPositionForEntity(Selector.Entity, GSV, ref OrderedModels); Selector.Entity.ScaleObject(new Vector3(1f)); b.EntityList.Add(Selector.Entity); } } Selector = null; } } //Water.Update(Graphics.GraphicsDevice, GSV, GT, MS, KS); PreviousMouseState2 = PreviousMouseState; PreviousMouseState = MS; if (Interpolation != 0) { var N = (1f / (200f * SpeedInterpolation)) * Interpolation; Cam.Rotate(MathHelper.Lerp(0, SpeedInterpolation, N), false); if (Interpolation > 0) { Interpolation--; } else { Interpolation++; } } else { SpeedInterpolation = 0; } HelpButton.Update(GT, MS, KS); if (HelpButton.Toggled) { UI.UIText.UIFrame.Overlay.Update(MS); } }