public void update(View v) { oldKS = newKS; newKS = Keyboard.GetState(); //camera movement if (newKS.IsKeyDown(Keys.W)) { v.moveCamera(View.Camera_Directions.UP); } if (newKS.IsKeyDown(Keys.S)) { v.moveCamera(View.Camera_Directions.DOWN); } if (newKS.IsKeyDown(Keys.A)) { v.moveCamera(View.Camera_Directions.LEFT); } if (newKS.IsKeyDown(Keys.D)) { v.moveCamera(View.Camera_Directions.RIGHT); } if (newKS.IsKeyDown(Keys.Q)) { v.zoomCamera(View.Zoom_Directions.IN); } if (newKS.IsKeyDown(Keys.E)) { v.zoomCamera(View.Zoom_Directions.OUT); } //pausing if (newKS.IsKeyDown(Keys.Space) && !oldKS.IsKeyDown(Keys.Space)) { Game1.paused = !Game1.paused; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { view = new View(GraphicsDevice); user = new UserController(); user.initialize(); agents = new List<Agent>(Constants.MAX_AGENTS); agents2 = new List<Agent>(Constants.MAX_AGENTS); initWorld(); initAgents(); base.Initialize(); }