Esempio n. 1
0
        public void doesClientSidePredictionUpdate()
        {
            World world = new World();

            world.setPlayerPos(new Tuple <int, int>(0, 0));
            Player    player    = new Player(10, 10);
            Technique technique = new ClientSidePrediction();

            technique.update(new Client(true, world, 0), player, world, "7");

            string expected = "7";
            string result   = technique.getLastAction();

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public void doesClientSidePredictionProcess()
        {
            World world = new World();

            world.setPlayerPos(new Tuple <int, int>(0, 0));
            Player    player    = new Player(0, 0);
            Technique technique = new ClientSidePrediction();
            Client    clnt      = new Client(true, world, 0);

            technique.update(clnt, player, world, "1");
            Thread.Sleep(1000); // Wait for packet to be recieved

            Tuple <int, int> expected = new Tuple <int, int>(0, 1);
            Tuple <int, int> result   = technique.process(clnt, world);

            Assert.AreEqual(expected, result);
        }