本文整理汇总了C#中Creature.DamageText方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.DamageText方法的具体用法?C# Creature.DamageText怎么用?C# Creature.DamageText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature.DamageText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeDamage
public virtual long TakeDamage(Creature offender, DamageDesc damageDesc)
{
if (m_behaviourType == BehaviourType.Death)
return 0;
if (m_buffEffects[(int)DamageDesc.BuffType.Macho].m_run == true)
{
DamageText(RefData.Instance.RefTexts(MultiLang.ID.Blocked), Vector3.one, Color.white, DamageNumberSprite.MovementType.ParabolaAlpha);
return 0;
}
if (m_buffEffects[(int)DamageDesc.BuffType.Dash].m_run == true)
{
DamageText(RefData.Instance.RefTexts(MultiLang.ID.Blocked), Vector3.one, Color.white, DamageNumberSprite.MovementType.ParabolaAlpha);
return 0;
}
bool critical = false;
float criticalDamage = 1f;
if (offender != null)
{
if (Random.Range(0, 1f) < offender.m_creatureProperty.CriticalChance)
{
critical = true;
criticalDamage = 1f+offender.m_creatureProperty.CriticalDamage;
}
}
long dmg = (long)(damageDesc.Damage*criticalDamage);
dmg -= (long)(dmg*m_creatureProperty.DamageReduction);
if (dmg <= 0)
{
dmg = Random.Range(0, 2);
}
if (dmg > 0)
{
if (Random.Range(0f, 1f) < m_creatureProperty.Dodge)
{
DamageText(RefData.Instance.RefTexts(MultiLang.ID.Dodged), Vector3.one, Color.white, DamageNumberSprite.MovementType.ParabolaAlpha);
return 0;
}
if (m_creatureProperty.Shield > 0)
{
--m_creatureProperty.Shield;
DamageText(RefData.Instance.RefTexts(MultiLang.ID.Shielded), Vector3.one, Color.white, DamageNumberSprite.MovementType.ParabolaAlpha);
return 0;
}
}
string strDamage = dmg.ToString();
if (dmg == 0)
{
strDamage = RefData.Instance.RefTexts(MultiLang.ID.Blocked);
DamageText(strDamage, Vector3.one, Color.white, DamageNumberSprite.MovementType.ParabolaAlpha);
return 0;
}
if (m_ingTakenDamageEffect < Const.MaxShowDamageNumber)
{
Vector3 damageTextScale = Vector3.one;
++m_ingTakenDamageEffect;
Color color = Color.white;
if (critical == true)
{
strDamage = dmg.ToString();
color = Color.red;
damageTextScale *= 1.1f;
}
else if (damageDesc.DamageBuffType == DamageDesc.BuffType.Poison)
{
color = Color.magenta;
}
else
{
if (offender != null && offender.RefMob.mobAI == MobAIType.Follow)
{
damageTextScale *= 0.8f;
switch(offender.RefMob.id)
{
case 30001:
color = Color.clear;
break;
case 30002:
color = Color.red;
break;
case 30003:
color = Color.blue;
break;
case 30004:
color = Color.cyan;
break;
case 30005:
color = Color.yellow;
break;
case 30006:
color = Color.magenta;
break;
//.........这里部分代码省略.........