本文整理汇总了C#中Game.Logic.Phy.Object.Living.Distance方法的典型用法代码示例。如果您正苦于以下问题:C# Living.Distance方法的具体用法?C# Living.Distance怎么用?C# Living.Distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Logic.Phy.Object.Living
的用法示例。
在下文中一共展示了Living.Distance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Beat
public bool Beat(Living target, string action, int demageAmount, int criticalAmount, int delay, int livingCount, int attackEffect)
{
if (target == null || target.IsLiving == false)
return false;
demageAmount = MakeDamage(target);
//Console.WriteLine("Living.Beat() : {0}", demageAmount);
int dis = (int)target.Distance(X, Y);
if (dis <= MaxBeatDis) //加了等号
{
if (X - target.X > 0)
{
Direction = -1;
}
else
{
Direction = 1;
}
m_game.AddAction(new LivingBeatAction(this, target, demageAmount, criticalAmount, action, delay, livingCount, attackEffect));
return true;
}
else
{
return false;
}
}
示例2: MakeDamage
protected int MakeDamage(Living target)
{
double baseDamage = m_owner.BaseDamage;
double baseGuard = target.BaseGuard;
double defence = target.Defence;
double attack = m_owner.Attack;
if (m_owner.IgnoreArmor)
{
baseGuard = 0;
defence = 0;
}
float damagePlus = m_owner.CurrentDamagePlus;
float shootMinus = m_owner.CurrentShootMinus;
//伤害={ 基础伤害*(1+攻击*0.1%)*[1-(基础护甲/200+防御*0.03%)] }*(1+道具攻击加成)*炸弹威力*连击系数
// double damage = (baseDamage * ( 1 + attack * 0.001) * (1 - (baseGuard / 200 + defence * 0.003))) * (1 + damagePlus) * shootMinus ;
double DR1 = 0.95 * (target.BaseGuard - 3 * m_owner.Grade) / (500 + target.BaseGuard - 3 * m_owner.Grade);//护甲提供伤害减免
double DR2 = 0;
if ((target.Defence - m_owner.Lucky) < 0)
{
DR2 = 0;
}
else
{
DR2 = 0.95 * (target.Defence - m_owner.Lucky) / (600 + target.Defence - m_owner.Lucky); //防御提供的伤害减免
}
//DR2 = DR2 < 0 ? 0 : DR2;
double damage = (baseDamage * (1 + attack * 0.001) * (1 - (DR1 + DR2 - DR1 * DR2))) * damagePlus * shootMinus;
Point p = new Point(X, Y);
double distance = target.Distance(p);
if (distance < m_radius)
{
damage = damage * (1 - distance / m_radius / 4);
if (damage < 0)
{
return 1;
}
}
else
{
return 0;
}
return (int)damage;
}