当前位置: 首页>>代码示例>>C#>>正文


C# Fighter.SetName方法代码示例

本文整理汇总了C#中Fighter.SetName方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.SetName方法的具体用法?C# Fighter.SetName怎么用?C# Fighter.SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fighter的用法示例。


在下文中一共展示了Fighter.SetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCharacter

        public Player CreateCharacter(string Class, UserInteraction ui)
        {
            Class = Class.ToLower();
            Player newChar;
            switch(Class)
            {
                case "barbarian":
                    newChar = new Barbarian(new int[] { 15, 15, 15, 10, 9, 10 });
                    newChar.SetArmor(Armors.chainShirt);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.battleaxe));
                    newChar.SetName("Bob");
                    break;

                case "bard":
                    newChar = new Bard(new int[] { 15, 10, 15, 10, 9, 15 });
                    newChar.SetArmor(Armors.leatherArmor);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.rapier));
                    newChar.SetName("Bill");
                    break;

                case "cleric":
                    newChar = new Cleric(new int[] { 15, 10, 15, 15, 9, 10 });
                    newChar.SetArmor(Armors.breastplate);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.heavyMace));
                    newChar.SetOffHand(Armors.heavyWoodenShield);
                    newChar.SetName("Chad");
                    break;

                case "druid":
                    newChar = new Druid(new int[] { 15, 10, 15, 15, 9, 10 });
                    newChar.SetArmor(Armors.hideArmor);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.club));
                    newChar.SetOffHand(Armors.heavyWoodenShield);
                    newChar.SetName("Dave");
                    break;

                case "fighter":
                    newChar = new Fighter(new int[] { 15, 15, 15, 10, 9, 10 });
                    newChar.SetArmor(Armors.breastplate);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.longsword));
                    newChar.SetOffHand(Armors.heavyWoodenShield);
                    newChar.SetName("Frank");
                    break;

                case "monk":
                    newChar = new Monk(new int[] { 15, 10, 15, 10, 15, 9 });
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.quarterstaff));
                    newChar.SetName("Molly");
                    break;

                case "paladin":
                    newChar = new Paladin(new int[] { 15, 10, 15, 9, 15, 10 });
                    newChar.SetArmor(Armors.breastplate);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.longsword));
                    newChar.SetOffHand(Armors.heavyWoodenShield);
                    newChar.SetName("Phil");
                    break;

                case "ranger":
                    newChar = new Ranger(new int[] { 15, 10, 15, 9, 15, 10 });
                    newChar.SetArmor(Armors.leatherArmor);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.longbow));
                    newChar.SetName("Randy");
                    break;

                case "rogue":
                    newChar = new Rogue(new int[] { 15, 10, 15, 15, 9, 10 });
                    newChar.SetArmor(Armors.leatherArmor);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.rapier));
                    newChar.SetName("Rudy");
                    break;

                case "sorcerer":
                    newChar = new Sorcerer(new int[] { 10, 15, 15, 10, 9, 15 });
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.lightCrossbow));
                    newChar.SetName("Steve");
                    break;

                case "wizard":
                    newChar = new Wizard(new int[] { 10, 15, 15, 15, 9, 10 });
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.lightCrossbow));
                    newChar.SetName("Willis");
                    break;

                default:
                    newChar =  new Barbarian(new int[] { 10, 10, 10, 10, 10, 10 });
                    newChar.SetArmor(Armors.chainShirt);
                    newChar.SetMainHand(new MasterworkWeapon(Weapons.battleaxe));
                    newChar.SetName("Default");
                    break;
            }
            newChar.SetUI(ui);
            newChar.AddItems(new Item[] { Consumables.minorHealthPotion, Consumables.minorHealthPotion, Consumables.minorManaPotion, Consumables.minorManaPotion, Consumables.minorHarmingPotion, Consumables.minorHarmingPotion });
            return newChar;
        }
开发者ID:EWUTinfoilHats,项目名称:CSCD454-FinalProject,代码行数:95,代码来源:DefaultCharacterFactory.cs


注:本文中的Fighter.SetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。