/// <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(); } newKeyboardState = Keyboard.GetState(); MouseState newMouseState = Mouse.GetState(); //Keyboard Input Registration if (newKeyboardState.IsKeyDown(Keys.A)) { player.HorizontalMov("Left"); } if (newKeyboardState.IsKeyDown(Keys.D)) { player.HorizontalMov("Right"); } if (newKeyboardState.IsKeyDown(Keys.W)) { player.VerticalMov("Up"); } if (newKeyboardState.IsKeyDown(Keys.S)) { player.VerticalMov("Down"); } if (oldKeyboardState.IsKeyDown(Keys.Q) && newKeyboardState.IsKeyUp(Keys.Q)) { foreach (var x in Textbox.TextBoxes) { if (x.Continue == false) { x.SkipText = false; x.NextPage(); } else { x.SkipText = true; } } if (Textbox.TextBoxes.Any(x => x.Finish == true)) { Textbox.Delete(); } } if (newKeyboardState.IsKeyDown(Keys.X) && !oldKeyboardState.IsKeyDown(Keys.X)) { List <Tuple <int, int> > TestPath = Utility.GeneratePath(Tuple.Create(1, 1), Tuple.Create(256, 256)); foreach (Tuple <int, int> z in TestPath) { Console.WriteLine(z); } //Console.WriteLine(Utility.GeneratePath(Tuple.Create(0,0),Tuple.Create(256,256))); //NPC.ToggleFollow("Mathijs"); /* * List<Tuple<int, int>> input = new List<Tuple<int, int>> * { * Tuple.Create(3, 6), Tuple.Create(4, 8), Tuple.Create(3, 10) * }; * * Objects.RemoveObj(input); */ } if (newKeyboardState.IsKeyDown(Keys.E) && !oldKeyboardState.IsKeyDown(Keys.E)) { Console.WriteLine("??????????????"); EventHandler.EventList.Add(new EventHandler(1)); } if (newKeyboardState.IsKeyDown(Keys.Space) && !oldKeyboardState.IsKeyDown(Keys.Space)) { if (Player.Player1.Frozen != true) { Objects obj = Objects.ObjectList.Find(x => x.CanInteract == true); if (obj != null) { obj.Interact(); } } } //----------------------------- //Updating of all the classes, This is a temperary Test setup /* foreach(var _npc in NPC.NPClist) * { * _npc.Update(); * } */ if (Autowalker.AutowalkerList.Any()) { foreach (var autowalker in Autowalker.AutowalkerList) { autowalker.Update(); } Autowalker.DeleteAutoWalker(); } if (EventHandler.EventList.Count > 0) { if (EventHandler.Continue == true) { EventHandler.EventUpdate(); } } if (Textbox.TextBoxes.Any() == true) { Textbox.Update(); } Player.Player1.TickUpdate(); AnimationTick.TickUpdate(); Camera.Update(); base.Update(gameTime); oldKeyboardState = newKeyboardState; }