コード例 #1
0
ファイル: King.cs プロジェクト: watset1/IN710watset1
 public King(ListBox listBox, String name)
     : base(listBox, name)
 {
     this.Name = name;
     this.ListBox = listBox;
     weapon = new Sword();
 }
コード例 #2
0
        public void Character_DefaultWeaponIsSetAtConstruction()
        {
            IWeaponBehaviour expectedDefaultWeapon = new Sword();

            Character character = new King("Johnny");

            Assert.AreEqual(character.UseWeapon(), expectedDefaultWeapon.UseWeapon());
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: paddymoran/IN710morapd1
        /**
         *  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");
            }
        }
コード例 #4
0
ファイル: King.cs プロジェクト: lifengdai/IN710dail3
 public King(string name)
     : base(name)
 {
     base.name = name;
     weapon = new Sword();
 }
コード例 #5
0
 public King(string name)
     : base(name)
 {
     weapon = new Sword();
     declaim = "I am the most mighty of Kings!";
 }
コード例 #6
0
ファイル: King.cs プロジェクト: acraig94/IN710craia4
 public King(ListBox Battlebox, string Name)
 {
     name = Name;
     weaponType = new Sword();
     battleBox = Battlebox;
 }
コード例 #7
0
ファイル: King.cs プロジェクト: sleemjm1/IN710-sleemjm1
 public King(ListBox listBox, String myName)
     : base(listBox, myName)
 {
     Weapon = new Sword();
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: sleemjm1/IN710-sleemjm1
        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);
                }
            }
        }
コード例 #9
0
ファイル: King.cs プロジェクト: gregfield/IN710-fielgm2
 public King(String name)
     : base(name)
 {
     Weapon = new Sword();
 }
コード例 #10
0
ファイル: King.cs プロジェクト: hornoo/IN710hornerb1
 //Child of charater class, when instantiated a default weapon is set forht type of charater
 public King(String characterName)
     : base(characterName)
 {
     weapon = new Sword();
 }