private void NewTurn() { PlayerTank player = currentGame.CurrentPlayerTank(); TankController tankController = player.Player(); this.Text = "Tank Battle - Round " + currentGame.CurrentRound() + "of " + currentGame.GetTotalRounds(); BackColor = tankController.PlayerColour(); lblPlayerName.Text = tankController.Identifier(); SetAimingAngle(player.GetTankAngle()); SetPower(player.GetTankPower()); if (currentGame.Wind() > 0) { lblWindValue.Text = currentGame.Wind() + " E"; } else { lblWindValue.Text = currentGame.Wind() * -1 + " W"; } cmbWeapon.Items.Clear(); Tank tank = player.CreateTank(); String[] lWeaponsAvailable = tank.ListWeapons(); cmbWeapon.Items.AddRange(lWeaponsAvailable); ChangeWeapon(player.GetCurrentWeapon()); tankController.StartTurn(this, currentGame); }
public override void FireWeapon(int weapon, PlayerTank playerTank, Game currentGame) { int x = playerTank.X(); int y = playerTank.Y(); float xPos = (float)x + (Tank.HEIGHT / 2); float yPos = (float)y + (Tank.WIDTH / 2); TankController player = playerTank.Player(); Explosion explosion = new Explosion(100, 4, 4); Projectile projectile = new Projectile(xPos, yPos, playerTank.GetTankAngle(), playerTank.GetTankPower(), 0.01f, explosion, player); currentGame.AddWeaponEffect(projectile); }