Exemple #1
0
        public void TestProjectileMethod()
        {
            world world1 = new world();

            projectile p = new projectile(0, new Vector2D(0, 0), new Vector2D(0, 0), true, 1);
            star       s = new star(0, new Vector2D(0, 0), 1);

            world1.addStar(s);
            String     A  = p.ToString();
            projectile s1 = JsonConvert.DeserializeObject <projectile>(A);

            world1.setFrame(50);
            world1.setRespawn(300);
            world1.setSize(750);
            world1.update();
            Assert.AreEqual(p.getID(), 0);
            Assert.AreEqual(new Vector2D(0, 0), p.getloc());
            Assert.AreEqual(new Vector2D(0, 0), p.getdir());
            Assert.AreEqual(p.checkAlive(), true);
            Assert.AreEqual(p.getOwner(), 1);
            p = new projectile(0, new Vector2D(0, 0), new Vector2D(0, 0), true, 1);
            p.update(750, world1.getStar().Values);
            p.die();

            projectile p1 = new projectile(1, new Vector2D(0, 376), new Vector2D(0, 0), true, 2);

            p1.update(750, world1.getStar().Values);
        }