示例#1
0
 public Knight(ListBox listBox, String name)
     : base(listBox, name)
 {
     this.Name = name;
     this.ListBox = listBox;
     weapon = new Knife();
 }
 //Constructor
 public Troll(string name) : base(name)
 {
     this.name = name;
     weapon    = new Knife();
 }
示例#3
0
 public Knight(ListBox BattleBox, string Name)
 {
     name = Name;
     weaponType = new Knife();
     battleBox = BattleBox;
 }
示例#4
0
 public Knight(ListBox listBox, String myName)
     : base(listBox, myName)
 {
     Weapon = new Knife();
 }
示例#5
0
        /**
         *  Change weapon button click handler
         */
        private void button1_Click(object sender, EventArgs e)
        {
            // Get the checked characters
            List<int> selectedCharacters = getCheckedItemsInCheckedListBox(weaponCheckedListBox);

            // check at least one character is selected
            if (selectedCharacters.Count > 0)
            {
                IWeaponBehaviour newWeapon = null;

                // Get the weapon type
                if (rdSword.Checked)
                    newWeapon = new Sword();
                else if (rdKnife.Checked)
                    newWeapon = new Knife();
                else if (rdBow.Checked)
                    newWeapon = new Bow();
                else
                    MessageBox.Show("Please select a new weapon for the character(s)");

                // If a weapon was selected, change the characters weapon type(s)
                if (newWeapon != null)
                {
                    foreach (int charaterIndex in selectedCharacters)
                    {
                        gameManager.ChangeCharactersWeapon(charaterIndex, newWeapon);
                    }

                    // Set change weapon radios back to the default of sword
                    rdSword.Checked = true;
                }
            }
            else
            {
                MessageBox.Show("Please select at least one character to change the weapon of");
            }
        }
示例#6
0
 public Knight(String name)
     : base(name)
 {
     Weapon = new Knife();
 }
示例#7
0
 public Knight(String name) : base(name)
 {
     Weapon = new Knife();
 }
示例#8
0
 public Knight(string name)
     : base(name)
 {
     base.name = name;
     weapon = new Knife();
 }
示例#9
0
 //Child of charater class, when instantiated a default weapon is set forht type of charater
 public Knight(String characterName)
     : base(characterName)
 {
     weapon = new Knife();
 }
示例#10
0
 public Knight(string name) : base(name)
 {
     weapon  = new Knife();
     declaim = "I am a chivalrous Knight!";
 }
示例#11
0
 public Knight(string name)
     : base(name)
 {
     weapon = new Knife();
     declaim = "I am a chivalrous Knight!";
 }
示例#12
0
 public Knight(ListBox listBox, String myName) : base(listBox, myName)
 {
     Weapon = new Knife();
 }
示例#13
0
 public Knight(string name) :
     base(name)
 {
     base.name = name;
     weapon    = new Knife();
 }
示例#14
0
        private void button1_Click(object sender, EventArgs e)
        {
            IWeapon newWeapon = null;
            if (rdBow.Checked)
            {
                newWeapon = new Bow();
            }
            else if (rdSword.Checked)
            {
                newWeapon = new Sword();
            }
            else if (rdKnife.Checked)
            {
                newWeapon = new Knife();
            }

            if (newWeapon == null)
            {
                MessageBox.Show("Please select a new weapon.");
            }
            else
            {
                foreach (int indexChecked in checkedListBox2.CheckedIndices)
                {
                    Character c = characterList[indexChecked];
                    c.ChangeWeapon(newWeapon);
                }
            }
        }