本文整理汇总了C#中Conquest.Units.Unit.onMissedAttack方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.onMissedAttack方法的具体用法?C# Unit.onMissedAttack怎么用?C# Unit.onMissedAttack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conquest.Units.Unit
的用法示例。
在下文中一共展示了Unit.onMissedAttack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: takeDamage
// Takes the given amount of damage
public virtual int takeDamage(ref AttackInfo info, ref Unit instigator, ref BattleMap map)
{
// Variables
int oldHealth= health;
int amount= info.damage;
if((float)(Start.rng.NextDouble())<= info.accuracy)
{
amount= instigator.onDealtDamage(health, amount, this, ref map);
if((float)(Start.rng.NextDouble())<= info.criticalChance)
{
// Animate Critical
Console.WriteLine("Critical Hit!");
info.criticalHit= true;
amount= instigator.onCriticalHit(health, amount, this, ref map);
amount= onHitByCritical(health, amount, this, ref map);
}
else
{
// Animate regular
}
amount= onTakeDamage(oldHealth, health, amount, ref instigator, ref map);
health-= amount;
}
else
{
Console.WriteLine("Missed!");
// Animate Miss
info.missed= true;
onDodgedAttack(amount, ref instigator, ref map);
instigator.onMissedAttack(amount, this, ref map);
}
if(health== 0)
map.removeUnit(map.getFullUnitID(mapPos));
return health;
}