Пример #1
0
        private void NewTurn()
        {
            //throw new NotImplementedException();
            //currentGame.GetPlayerTank().GetPlayerById();
            PlayerTank     currentTankPlayer = currentGame.GetPlayerTank();
            TankController currentId         = currentTankPlayer.GetPlayerById();

            // Setting Form Title Caption to Current Round
            this.Text = "Tank Battle - Round " + currentGame.CurrentRound() + " of " + currentGame.GetMaxRounds();

            // Set back color of control panel
            controlPanel.BackColor = currentId.GetTankColour();
            // Set player name to tank name
            label1.Text = currentId.Identifier();
            // Call AimTurret() to set current angle
            AimTurret(currentTankPlayer.GetPlayerAngle());
            // Call SetPower() to set current power
            SetPower(currentTankPlayer.GetTankPower());

            label7.Text = trackBar1.Value.ToString();

            // Updating wind label
            if (currentGame.WindSpeed() < 0)
            {
                label3.Text = currentGame.WindSpeed() + "W";
            }
            else
            {
                label3.Text = currentGame.WindSpeed() + "E";
            }

            // Clearing Combobox
            comboBox1.Items.Clear();

            // Adding to the Combobox
            foreach (string x in currentTankPlayer.CreateTank().WeaponList())
            {
                comboBox1.Items.Add(x);
            }

            // Setting the current weapon to the current player
            SetWeaponIndex(currentTankPlayer.GetCurrentWeapon());

            // Calling BeginTurn()
            currentId.BeginTurn(this, currentGame);

            /*
             * button1.TabStop = false;
             * comboBox1.TabStop = false;
             * numericUpDown1.TabStop = false;
             * trackBar1.TabStop = false;*/

            label7.Text = trackBar1.Value.ToString();

            debounce = 0;
        }
Пример #2
0
        public PlayerTank(TankController player, int tankX, int tankY, GameController game)
        {
            // Initialising the player, tank coordinates, and tankGame fields
            tankPlayer = player;
            tankXPos   = tankX;
            tankYPos   = tankY;
            tankGame   = game;

            tank = player.CreateTank();
            currentDurability = tank.GetHealth();

            tankAngle   = 0;
            tankPower   = 25;
            currentWeap = 0;

            tankBMP = tank.CreateTankBMP(tankPlayer.GetTankColour(), tankAngle);
        }
Пример #3
0
 public void AimTurret(float angle)
 {
     // Setting up the PlayerTank's current aiming angle
     tankAngle = angle;
     tankBMP   = tank.CreateTankBMP(tankPlayer.GetTankColour(), tankAngle);
 }