예제 #1
0
        /// <summary>
        /// This method is used to update form elements to reflect who the current player is.
        /// </summary>
        private void NewTurn()
        {
            currentTank = currentGame.GetCurrentPlayerTank();

            Opponent opponentTank = currentTank.GetPlayer();

            Text                 = String.Format("Tank Battle - Round {0} of {1}", currentGame.GetRoundNumber(), currentGame.GetMaxRounds());
            BackColor            = opponentTank.GetColour();
            playerNameLabel.Text = opponentTank.Identifier();
            SetAngle(currentTank.GetTankAngle());
            SetPower(currentTank.GetCurrentPower());

            int currentWind = currentGame.GetWindSpeed();

            if (currentWind > 0)
            {
                currWindLabel.Text = String.Format("{0} E", currentWind);
            }
            else
            {
                currentWind        = currentWind * -1;
                currWindLabel.Text = String.Format("{0} W", currentWind);
            }
            weaponComboBox.Items.Clear();
            TankModel currentTankModel = currentTank.GetTank();

            foreach (String weapon in currentTankModel.WeaponList())
            {
                weaponComboBox.Items.Add(weapon);
            }
            SetWeapon(weaponComboBox.SelectedIndex);
            opponentTank.NewTurn(this, currentGame);
            controlPanel.BackColor = opponentTank.GetColour();
        }
예제 #2
0
파일: BattleForm.cs 프로젝트: KALVS/CAB201
        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");
        }