namespace 枚举
{
enum E_sexType
{
/// <summary>
/// 男性
/// </summary>
Man,
/// <summary>
/// 女性
/// </summary>
Woman,
}
enum E_occupation
{ /// <summary>
/// 战士
/// </summary>
Warrior,
/// <summary>
/// 猎人
/// </summary>
Hunter,
/// <summary>
/// 法师
/// </summary>
Master,
}
class program {
static void Main (String[] args)
{
try
{
int atk=0;
int def=0;
string skill="";
E_sexType sextype;
Console.WriteLine("请选择英雄性别:男性0 女性1");
sextype=(E_sexType)int.Parse( Console.ReadLine());
switch(sextype)
{
case E_sexType.Man:
atk = 50;
def = 100;
break;
case E_sexType.Woman:
atk = 150;
def = 20;
break;
}
E_occupation occupation= new E_occupation();
Console.WriteLine("请选择英雄职业:战士0 猎人1 法师2");
occupation = (E_occupation)int.Parse(Console.ReadLine());
switch (occupation)
{
case E_occupation.Warrior:
atk += 20;
def += 100;
skill = "冲锋";
break;
case E_occupation.Hunter:
atk += 120;
def += 30;
skill = "假死";
break;
case E_occupation.Master:
atk += 200;
def += 10;
skill = "奥术攻击";
break;
}
Console.WriteLine("你选择了{0} ,攻击力{1} ,防御力{2} ,职业技能 {3}。", sextype, atk, def, skill);
}
catch (Exception e) { Console.WriteLine("请输入数字"); }
}
}
}