public void TestCreatGamePlay() { //variable pour le choix du GamePlay: 0 pour NewGamePlay, 1 pour LoadGamePlay int choix_game = 0; Player p1; //choix Map demo :0 et choix du people Elf 0 p1 = new PlayerImpl("nour", 0, 0); Player p2; //choix Map demo :0 et choix du people Orc 1 p2 = new PlayerImpl("marc", 0, 1); // demande entre LoadGameplay et NewGamePlay switch (choix_game) { case 0: //NewGamePlay GamePlayBuilder builder_new = new NewGamePlayImpl(); GamePlay game_new = builder_new.start(p1, p2); break; case 1: //LoadGamePlay GamePlayBuilder builder_load = new LoadGamePlayImpl(); GamePlay game_load = builder_load.start(p1, p2); break; } }
/// <summary> /// Collide. /// </summary> /// <param name="entity"> the entity </param> public override void collide(Entity entity) { if (entity is PlayerImpl) { this.player = (PlayerImpl)entity; this.InsertStrategy(); this.Position = (entity.Position); this.Hitbox = (entity.Hitbox); } }
public void TestHealthPowerUp() { PlayerImpl player = new PlayerImpl(ID.PLAYER, new GameImpl()); PPowerUp ppu = new PPowerUp(new Pair <int, int>(0, 0), 1, 1, ID.POWER_UP, PowerUpT.HEALTH, new LowStrategy()); player.Health = (INITIAL_H); Assert.AreEqual(player.Health, INITIAL_H); ppu.collide(player); Assert.AreEqual(player.Health, FINAL_H); ppu.update(); Assert.IsTrue(ppu.Dead); }
public void TestPlayer() { GameImpl gameTest = new GameImpl(); PlayerImpl testPlayer = new PlayerImpl(ID.PLAYER, gameTest); Assert.IsNotNull(testPlayer); Pair <int, int> position = testPlayer.Position; testPlayer.setSpeed(5, 5); testPlayer.update(); Assert.IsTrue(testPlayer.Position.Equals(position)); }
public void TestShieldPowerUp() { PlayerImpl player = new PlayerImpl(ID.PLAYER, new GameImpl()); PPowerUp ppu = new PPowerUp(new Pair <int, int>(0, 0), 1, 1, ID.POWER_UP, PowerUpT.SHIELD, new HighStrategy()); ppu.collide(player); Assert.IsTrue(player.Shield > 0); Assert.IsTrue(ppu.GetActivated()); Assert.IsNotNull(ppu.EntityStrategy); foreach (var i in Enumerable.Range(0, PowerUpT.SHIELD.getLifetime() + 1)) { ppu.update(); } Assert.IsTrue(ppu.Dead); Assert.AreEqual(player.Shield, 0); }
/// <summary> /// Insert effect. /// </summary> protected internal override void InsertEffect() { PlayerImpl player = this.EntityStrategy; if (this.Type.Equals(PowerUpT.HEALTH)) { player.Health = Clamp.clamp(player.Health + this.strategy.multiplyEffect(STANDARD_HEALTH), 0, 100); } else if (this.Type.Equals(PowerUpT.FIRE_BOOST)) { player.CoolDown = player.CoolDown - this.strategy.multiplyEffect(STANDARD_FIRE_RATE_BOOST); } else { if (this.GetActivated() == false) { player.SHield = this.strategy.multiplyEffect(SHIELD_S); } else if (player.Shield == 0) { this.setDead(); } } }
public void TestSamePlayer() { PlayerImpl samePlayer = new PlayerImpl("Alex", 5000, 4, 4); Assert.AreEqual(samePlayer, this.currentPlayer); }
public void PlayerImplTestPlayer() { this.currentPlayer = new PlayerImpl("Alex", 2000, 3, 3); this.scoreOp = new BasicScoreOperationStrategy(); this.lifeOp = new BasicLifeOperationStrategy(); }
public void LoadGame(MapImpl map, PlayerImpl player) { this.Pg = player; this.Map = map; }
public void TestCreatPlayer() { Player p; p = new PlayerImpl("nour", 0, 0); }