Ejemplo n.º 1
0
        /// <param name="angle">The angle of the line the tank will use</param>
        public void SetAngle(float angle)
        {
            this.angle = angle;
            Color c = player.GetColour();

            tankBitmap = player.GetTank().CreateTankBMP(c, angle);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This constructor stores player, tankX, tankY and game as private fields of GameplayTank.
        /// It then gets the Chassis by using the GenericPlayer's GetTank() method,
        /// then calls GetTankArmour() on it and stores this as the GameplayTank's current durability.
        /// This will go down as the tank takes damage.
        /// </summary>
        /// <param name="player">the player using the tank</param>
        /// <param name="tankX">coordinate</param>
        /// <param name="tankY">coordinate</param>
        /// <param name="game">the battle the tank is apart of</param>
        public GameplayTank(GenericPlayer player, int tankX, int tankY, Battle game)
        {
            this.player = player;
            this.tankX  = tankX;
            this.tankY  = tankY;
            this.game   = game;

            durability    = player.GetTank().GetTankArmour();
            angle         = 0;
            power         = 25;
            currentWeapon = 0;

            tankBitmap = player.GetTank().CreateTankBMP(player.GetColour(), angle);
        }
Ejemplo n.º 3
0
        private void NewTurn()
        {
            GameplayTank  tank   = currentGame.GetCurrentGameplayTank();
            GenericPlayer player = tank.GetPlayerNumber();

            //Sets the form caption
            Text = String.Format("Tank Battle - Round {0} of {1}", currentGame.GetCurrentRound(), currentGame.GetRounds());

            controlPanel.BackColor = player.GetColour();

            playerLabel.Text = player.PlayerName();

            SetAngle(tank.GetTankAngle());
            SetForce(tank.GetTankPower());

            int wind = currentGame.WindSpeed();

            if (wind >= 0)
            {
                windLabel.Text = String.Format("{0} E", wind);
            }
            else
            {
                windLabel.Text = String.Format("{0} W", Math.Abs(wind));
            }

            //Remove all the current selectable weapons and replace them with the current tanks weapons.
            weaponSelector.Items.Clear();
            String[] weapons = tank.GetTank().ListWeapons();
            foreach (String weapon in weapons)
            {
                weaponSelector.Items.Add(weapon);
            }
            //tank.SelectWeapon
            SelectWeapon(tank.GetCurrentWeapon());

            player.NewTurn(this, currentGame);
        }