public void TestStarMethod() { world world1 = new world(); star s = new star(0, new Vector2D(200, 200), 1); world1.addStar(s); world1.setFrame(50); world1.setRespawn(300); world1.setSize(750); world1.update(); s.update(51); s.update(102); s.update(160); s.update(230); }
public void TestStar2Method() { world world1 = new world(); star s = new star(0, new Vector2D(0, 200), 1); String A = s.ToString(); star s1 = JsonConvert.DeserializeObject <star>(A); world1.addStar(s); world1.setFrame(50); world1.setRespawn(300); world1.setSize(750); world1.update(); s.update(51); s.update(102); s.update(160); s.update(230); }
public void TestStar1Method() { world world1 = new world(); star s = new star(0, new Vector2D(0, -200), 1); s.setLoc(new Vector2D(0, 0)); Assert.AreEqual(new Vector2D(0, 0), s.getloc()); world1.addStar(s); world1.setFrame(50); world1.setRespawn(300); world1.setSize(750); world1.update(); s.update(51); s.update(102); s.update(160); s.update(230); }
public void TestWorldMethod() { world world1 = new world(); star s = new star(0, new Vector2D(0, 200), 1); projectile p1 = new projectile(1, new Vector2D(0, 376), new Vector2D(0, 0), true, 2); Ship ship = new Ship(1, new Vector2D(0, 0), new Vector2D(0, 0), false, "s", 5, 0); String A = s.ToString(); star s1 = JsonConvert.DeserializeObject <star>(A); world1.addStar(s); world1.setFrame(0); world1.addShip(ship); world1.Fire(1); world1.addproj(p1); world1.setRespawn(300); world1.setSize(750); Assert.AreEqual(world1.getProj().Values.Count, 1); Assert.AreEqual(world1.getShip().Values.Count, 1); Assert.AreEqual(world1.getStar().Values.Count, 1); ship = new Ship(1, new Vector2D(0, 0), new Vector2D(0, 0), true, "s", 5, 0); for (int i = 0; i <= 4; i++) { world1.getShip()[1].hpdecrease(); } world1.respawn(ship); world1.addLostID(1); world1.cleanup(); world1.removeProjectile(p1); world1.removeStar(s); world1.removeShip(ship); Assert.AreEqual(world1.getShip().Values.Count, 0); Assert.AreEqual(world1.getShip().Values.Count, 0); Assert.AreEqual(world1.getStar().Values.Count, 0); world1.update(); s.update(51); s.update(102); s.update(160); s.update(230); }
public void TestworldMethod1() { world world1 = new world(); star s = new star(0, new Vector2D(0, -200), 1); Ship ship = new Ship(1, new Vector2D(0, 0), new Vector2D(0, 0), false, "s", 5, 0); projectile p1 = new projectile(1, new Vector2D(0, 10), new Vector2D(0, 0), true, 2); world1.addproj(p1); world1.addShip(ship); s.setLoc(new Vector2D(0, 0)); Assert.AreEqual(new Vector2D(0, 0), s.getloc()); world1.addStar(s); world1.setFrame(50); world1.setRespawn(300); world1.setSize(750); world1.update(); s.update(51); s.update(102); s.update(160); s.update(230); }
protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } //calls on_hit every update call after 4 seconds. just for demo purpose. if (gameTime.TotalGameTime > TimeSpan.FromSeconds(4)) { STAR.on_hit(); } STAR.update(gameTime); base.Update(gameTime); }