本文整理汇总了C#中Entity.TakeDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.TakeDamage方法的具体用法?C# Entity.TakeDamage怎么用?C# Entity.TakeDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.TakeDamage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override void Execute(Entity parEntity)
{
if (canAttack)
{
Debug.Log("simple Attack");
parEntity.TakeDamage(this._damage);
this.GetComponent<Entity>().TakeBreathCost(this._damageToBreath, this._breathMultiplier);
_currentCoolDown = 0;
parEntity.transform.DOShakeScale(0.7f, 1, 10).OnComplete(() => parEntity.transform.DOKill(true));
}
}
示例2: resolveAttack
private void resolveAttack(Entity other)
{
// TODO: Add a timer-thing, so this method is not called every frame. Maybe use Coroutines.
bool kill = other.TakeDamage(_entity.Stats.Attack);
if (kill) // Prevent the enemy from hurting the player, if the player kills it first.
{
disengageAttack(other);
other.Die();
_entity.Stats.ScoreValue += other.Stats.ScoreValue;
_entity.Stats.Experience += other.Stats.Experience;
return;
}
bool died = _entity.TakeDamage(other.Stats.Attack);
if (died) _entity.Die();
}
示例3: Attack
public void Attack(Entity entity)
{
entity.TakeDamage(Strength);
}
示例4: Execute
public override void Execute(Entity parEntity)
{
parEntity.TakeDamage(this._damage);
//this.GetComponent<Entity>().TakeBreathCost(this._damageToBreath, this._breathMultiplier);
parEntity.transform.DOShakeScale(0.7f, 1, 10).OnComplete(() => parEntity.transform.DOKill(true));
}