コード例 #1
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);
        }