Пример #1
0
Файл: NPC.cs Проект: dav3ck/Game
        public void InitializeWalk(Tuple <int, int> Goal, bool _wait)
        {
            Tuple <int, int>         CurrentPosition = Screen.GridCords(CenterCordsX, CenterCordsY);
            List <Tuple <int, int> > _path           = Utility.GeneratePath(CurrentPosition, Goal);

            Autowalk = new Autowalker(this.Name, _path, Tuple.Create(CenterCordsX + (this.HitboxHalf), CenterCordsY - (this.HitboxHalf)), Tuple.Create(this.speed, (int)(this.speed * this.Vertical_Horizontal_Speed)), _wait);
        }
Пример #2
0
Файл: NPC.cs Проект: dav3ck/Game
        public void Follower()
        {
            Autowalker.ManualDeleteAutoWalker(Autowalk);

            List <Tuple <int, int> > _path = Utility.GeneratePath(Tuple.Create(this.Xtile, this.Ytile), Player.Player1.GetPrevTile());

            Autowalk = new Autowalker(this.Name, _path, Tuple.Create(CenterCordsX + (this.HitboxHalf), CenterCordsY - (this.HitboxHalf)), Tuple.Create(this.speed, (int)(this.speed * this.Vertical_Horizontal_Speed)), false);
        }
Пример #3
0
 public static void ManualDeleteAutoWalker(Autowalker x)
 {
     try
     {
         Autowalker.AutowalkerList.Remove(x);
     }
     catch (Exception) {
         Console.WriteLine("GAAT FOUT");
     }
 }
Пример #4
0
        /// <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;
        }