/// <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(); } MouseLocation = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); newMouse = Mouse.GetState(); newKeyboardState = Keyboard.GetState(); #region input if (newKeyboardState.IsKeyDown(Keys.S)) //testing script { if (!oldKeyboardState.IsKeyDown(Keys.S)) { // conversationController.startConv("help"); characterController.AllCharacters.Clear(); } } else if (oldKeyboardState.IsKeyDown(Keys.S)) { //nothing } if (newMouse.LeftButton == ButtonState.Pressed && oldMouse.LeftButton == ButtonState.Released) { int MapRow = (int)(MouseLocation.X / Constants.MapSquareSize); int MapCol = (int)(MouseLocation.Y / Constants.MapSquareSize); //IsDisplayingMoveRange = false; /* * foreach (Character c in PlayerCharacters) * { * if (Movement.testInputIsWithinMapBounds(MapRow, MapCol, mapController.Maps.ElementAt(mapController.CurrentMap))) * { * if (c.HasMove && c.Location.X == MapRow && c.Location.Y == MapCol) * { * Movement.calculateMovementRange((int)c.Location.X, (int)c.Location.Y, c.TotalModifier.MoveRange, mapController.Maps.ElementAt(mapController.CurrentMap), c); * IsDisplayingMoveRange = true; * selectCharacter(c); * break; * } * else if (c.Selected && IsDisplayingMoveRange && !isCharacterAt(MapRow, MapCol) && mapController.Maps.ElementAt(mapController.CurrentMap).map2DArray[MapRow][MapCol].inRangeFlag == 1) * { * c.moveToLocation(MapRow, MapCol); * IsDisplayingMoveRange = false; * c.Selected = false; * c.HasMove = false; * break; * } * else if (isCharacterAt(MapRow, MapCol) || mapController.Maps.ElementAt(mapController.CurrentMap).map2DArray[MapRow][MapCol].inRangeFlag != 1) * { * IsDisplayingMoveRange = false; * } * } * }*/ //if (situationController.AllowCharacterMovement) //{ .movementInput(situationController, mapController, characterController, MapRow, MapCol, mapController.getCurrentMap(), ref IsDisplayingMoveRange); } } #endregion /*if (turnCompleted()) * { * nextTurn(); * }*/ //turn logic //situationController.inputLogic(mapController, characterController, conversationController, Content, spriteBatch); situationController.tryNextTurn(characterController); CharacterMenu.Input(characterController.AllCharacters, oldMouse); /*if (InputMethods.checkIfMouseClickInBounds(OldMouse, new Vector2(0, 0), new Vector2(100, 100), (int)Constants.MouseButtons.Middle)) * { * Console.Write("youpressedit"); * }*/ oldKeyboardState = newKeyboardState; //necissary for functionality oldMouse = newMouse; // TODO: Add your update logic here //testConv.start(); //testConv.input(); //ConvController.Input(); //conversationController.Input(); base.Update(gameTime); }