Esempio n. 1
0
        /// <summary>
        /// Newly-created method used to update form elemtns to reflect who the current player is. It involves
        /// a number of things like changing the colours, angles, power, round number etc.
        ///
        /// Author John Santias and Hoang Nguyen October 2017
        /// </summary>
        private void NewTurn()
        {
            currentControlledTank = currentGame.GetCurrentGameplayTank();
            currentOpponent       = currentControlledTank.GetPlayerNumber();
            Text = "Tank Battle - Round " + currentGame.GetRound() + " of " + currentGame.GetTotalRounds();
            controlPanel.BackColor = currentOpponent.GetColour();
            playerLabel.Text       = currentOpponent.Name();
            currentControlledTank.SetAimingAngle(angleSet);
            currentControlledTank.SetPower(powerSet);
            windSpeed = currentGame.GetWindSpeed();

            if (windSpeed > 0)
            {
                windStatusLabel.Text = windSpeed + " E";
            }
            else if (windSpeed < 0)
            {
                windStatusLabel.Text = -windSpeed + " W";
            }
            weaponComboBox.Items.Clear();
            currentTankModel = currentControlledTank.GetTank();
            string[] weapons = currentTankModel.WeaponList();

            for (int i = 0; i < weapons.Length; i++)
            {
                weaponComboBox.Items.Add(weapons[i]);
            }

            weaponSet = currentControlledTank.GetWeaponIndex();
            SetWeaponIndex(weaponSet);
            currentOpponent.BeginTurn(this, currentGame);
        }
Esempio n. 2
0
        protected void NewTurn()
        {
            //<Summary>
            //Alex Holm N9918205
            //</Summary>

            Debug.WriteLine("CurrentTank Get Start");
            current_tank = currentGame.GetCurrentPlayerTank();

            Debug.WriteLine("CurrentTank Get Finalized");

            Debug.WriteLine("CurrentPlayer Get Start");
            current_player = current_tank.GetPlayer();
            Debug.WriteLine("CurrentTank Get Finalized");

            Debug.WriteLine("CurrentForm Title Get Start");
            string Title = ("Tank Battle - Round " + currentGame.CurrentRound() + " of " + currentGame.GetMaxRounds());

            this.Text = Title;
            Debug.WriteLine("CurrentForm Title Get Finalized");

            Debug.WriteLine("Current Player colour to control panel start");
            controlPanel.BackColor = current_player.GetColour();
            Debug.WriteLine("Current player colour to control panel done");
            PlayerLabel.Text = current_player.Identifier();
            AimTurret(current_tank.GetAngle());
            PowerIndicatorLabel.Text = current_tank.GetPower().ToString();
            SetForce(current_tank.GetPower());

            if (currentGame.WindSpeed() > 0)
            {
                Wind.Text = currentGame.WindSpeed().ToString() + " E";
            }
            else
            {
                Wind.Text = Math.Abs(currentGame.WindSpeed()).ToString() + " W";
            }

            weaponComboBox.Items.Clear();
            Chassis current_chassiss = current_tank.GetTank();

            foreach (String weapon in current_chassiss.Weapons())
            {
                weaponComboBox.Items.Add(weapon);
            }
            ChangeWeapon(weaponComboBox.SelectedIndex);
            current_player.BeginTurn(this, currentGame);
            Debug.WriteLine("Newturn");
        }