Exemple #1
0
        public override void Update(Input input)
        {
            base.Update(input);
            SetSecondThreadUpdateState(UpdateState.START);
            UpdateKeys(input);


            if (EngineController.gameRunning)
            {
                WorldController.world.Update(input);
                WorldController.worldMini.Update();
                //do game logic here
                while (secondThreadState != UpdateState.FINISHED)
                {
                }
                //Here we can have a list for each thread we are running of things that may need to be updated that require syncing
                //for example, if a fire has claimed a tile

                //  if (input.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.B))
                if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.B))
                {
                    jobWorker.AddJob(new Pathfinding(new Point(10, 10), new Point(10, 100)));

                    /*   EngineController.StartDebugTimer();
                     * AStarRoadOnly a = new AStarRoadOnly();
                     * // List<DrivingNode> list = a.GetDrivingNodeList(new Point(170, 203), WorldController.mouseTileHover);
                     * List<DrivingNode> list = a.GetDrivingNodeList(new Point(226, 268), WorldController.mouseTileHover);
                     * //  List<DrivingNode> list = a.GetDrivingNodeList(new Point(162, 202), new Point(173, 233));
                     * EngineController.StopDebugTimer();*/
                }
            }
        }
 public static void AddJob(Job job)
 {
     jobWorker.AddJob(job);
 }