示例#1
0
        public void CreatePlayer(string name)
        {
            Player.Name = name;
            UnitMaternity unit;

            switch (name)
            {
            case "Archer":
                unit = new UnitMaternity(new UnitArcherBuilder());
                break;

            case "Halberdier":
                unit = new UnitMaternity(new UnitHalberdierBuilder());
                break;

            case "Knight":
                unit = new UnitMaternity(new UnitKnightBuilder());
                break;

            case "Mage":
                unit = new UnitMaternity(new UnitMageBuilder());
                break;

            default:
                unit = new UnitMaternity(new UnitMageBuilder());
                break;
            }
            unit.UnitCreate();
            Player.Unit = unit.GetUnit();
        }
示例#2
0
        public void CreateOponents()
        {
            Player.Name = maskedTextBox_nameCharacter.Text;
            UnitMaternity unit;

            #region cast bot char
            if (radioButton_archer.Checked)
            {
                unit = new UnitMaternity(new UnitArcherBuilder());
                radioButton_archer.Checked = false;
            }
            else if (radioButton_halberdier.Checked)
            {
                unit = new UnitMaternity(new UnitHalberdierBuilder());
                radioButton_halberdier.Checked = false;
            }
            else if (radioButton_knight.Checked)
            {
                unit = new UnitMaternity(new UnitKnightBuilder());
                radioButton_knight.Checked = false;
            }
            else
            {
                unit = new UnitMaternity(new UnitMageBuilder());
                radioButton_mage.Checked = false;
            }
            #endregion

            unit.UnitCreate();
            Player.Unit = unit.GetUnit();

            BotSelect botSelect = new BotSelect();
            botSelect.SetBotWariorClass();
        }
示例#3
0
        public void SetBotWariorClass(string NameOfClass = null)
        {
            UnitMaternity unit;

            int choice = 0;

            if (NameOfClass != null)
            {
                switch (NameOfClass)
                {
                case "Archer":
                    choice = 1;
                    break;

                case "Halberdier":
                    choice = 2;
                    break;

                case "Knight":
                    choice = 3;
                    break;

                case "Mage":
                    choice = 4;
                    break;

                default:
                    choice = 1;
                    break;
                }
            }
            else
            {
                choice = GetRandomNumber();
            }

            switch (choice)
            {
            case 1:
                unit = new UnitMaternity(new UnitArcherBuilder());
                break;

            case 2:
                unit = new UnitMaternity(new UnitHalberdierBuilder());
                break;

            case 3:
                unit = new UnitMaternity(new UnitKnightBuilder());
                break;

            case 4:
                unit = new UnitMaternity(new UnitMageBuilder());
                break;

            default:
                unit = new UnitMaternity(new UnitKnightBuilder());
                break;
            }
            unit.UnitCreate();
            Bot.Unit = unit.GetUnit();
            Bot.Name = Bot.Unit.Name;
        }