protected override void Update(GameTime gameTime) { KeyboardState keyState = Keyboard.GetState(); MouseState mouseState = Mouse.GetState(); if (Keyboard.GetState().IsKeyDown(Keys.Escape) || Mouse.GetState().MiddleButton == ButtonState.Pressed) { this.Exit(); } if (mouseState.RightButton == ButtonState.Pressed && oldMouseState.RightButton == ButtonState.Released) { gamePaused = !gamePaused; Audio.Mute(gamePaused); } oldMouseState = mouseState; //if (gamePaused) return; GridManager.Update(); Tweenerizer.Update(); Audio.Update(); CloudManager.Update(); /* For Testing - Accepts keyboard/mouse */ #if PRODUCTION #else OrderedDictionary o = new OrderedDictionary(); o.Add("id", 0); if (keyState.IsKeyDown(Keys.Up)) { if (!oldState.IsKeyDown(Keys.Up)) { EventManager.Emit("user:bloat", o); } } else if (oldState.IsKeyDown(Keys.Up)) { EventManager.Emit("user:bloatEnd", o); } if (keyState.IsKeyDown(Keys.Down)) { if (!oldState.IsKeyDown(Keys.Down)) { EventManager.Emit("user:pinch", o); } } else if (oldState.IsKeyDown(Keys.Down)) { EventManager.Emit("user:pinchEnd", o); } if (keyState.IsKeyDown(Keys.Space)) { if (!oldState.IsKeyDown(Keys.Space)) { //o.Add("type", "theOcho"); //o.Add("value", 100); o.Add("userId", 0); EventManager.Emit("collector:attack", o); //EventManager.Emit("user:getBadge", o); //EventManager.Emit("user:getPoints", o); //EventManager.Emit("user:disconnect", o); } } if (keyState.IsKeyDown(Keys.D1)) { currentDisplay = 0; } else if (keyState.IsKeyDown(Keys.D2)) { currentDisplay = 1; } else if (keyState.IsKeyDown(Keys.D3)) { currentDisplay = 2; } else if (keyState.IsKeyDown(Keys.D4)) { currentDisplay = 3; } oldState = keyState; if (mouseState.LeftButton == ButtonState.Pressed) { if (initialMousePos.Equals(Vector2.Zero)) { initialMousePos = new Vector2(mouseState.X, mouseState.Y); } o.Add("x", (int)(mouseState.X - initialMousePos.X)); o.Add("y", (int)(mouseState.Y - initialMousePos.Y)); EventManager.Emit("user:touch", o); } else if (mouseState.LeftButton == ButtonState.Released) { if (initialMousePos.Equals(Vector2.Zero)) { EventManager.Emit("user:touchEnd", o); } initialMousePos = Vector2.Zero; } #endif //Camera update for movement ScreenManager.Update(gameTime); Light.Update(gameTime); /* End for testing */ oldState = keyState; base.Update(gameTime); }
protected override void UnloadContent() { Audio.Dispose(); }