本文整理汇总了C#中Party.isDefeated方法的典型用法代码示例。如果您正苦于以下问题:C# Party.isDefeated方法的具体用法?C# Party.isDefeated怎么用?C# Party.isDefeated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Party
的用法示例。
在下文中一共展示了Party.isDefeated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fight
static bool fight(Party p1, Party p2)
{
int averageLevel = 0;
foreach (IEngageable member in p1)
{
averageLevel += member.getLevel();
}
averageLevel /= p1.Count;
for (int i = 0; i < 3; i++)
{
switch (RandomPlus.genIntInc(5))
{
case 0: p2.addMember(new Swordsman(averageLevel)); break;
case 1: p2.addMember(new Assassin(averageLevel)); break;
case 2: p2.addMember(new Tank(averageLevel)); break;
case 3: p2.addMember(new Tank(averageLevel)); break;
case 4: p2.addMember(new Assassin(averageLevel)); break;
case 5: p2.addMember(new Swordsman(averageLevel)); break;
}
}
p2.addMember(new Cleric(averageLevel));
Battle.engage(p1, p2);
Console.WriteLine("-----------");
if (!p1.isDefeated())
{
Text.color("You win!\n", ConsoleColor.Cyan);
return true;
}
else
{
Text.color("You lose...\n", ConsoleColor.Red);
return false;
}
}