本文整理汇总了C#中Actor.TakeDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.TakeDamage方法的具体用法?C# Actor.TakeDamage怎么用?C# Actor.TakeDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actor
的用法示例。
在下文中一共展示了Actor.TakeDamage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggered
public void OnTriggered(Actor actor) {
if(actor.GetType() == typeof(Player)) {
actor.TakeDamage(gameObject, playerDamage * Time.deltaTime);
} else {
actor.TakeDamage(gameObject, aiDamage * Time.deltaTime);
}
}
示例2: OnTriggered
public void OnTriggered(Actor actor) {
// play sound
if(!triggered) {
spikesParent.transform.position = new Vector3(spikesParent.transform.position.x,
spikesParent.transform.position.y + spikesYOffset,
spikesParent.transform.position.z);
triggered = true;
}
if (actor.GetType() == typeof(Player))
actor.TakeDamage(gameObject, playerDamage);
else
actor.TakeDamage(gameObject, aiDamage);
spikesTimer = spikesTimerMax;
ParticleManager.InstantiateParticle(ParticleManager.Instance.Blood, actor.transform.position);
}
示例3: OnRemove
public void OnRemove(Actor actor)
{
actor.TakeDamage(dmg, "true", 0);
}
示例4: AttackActor
public virtual void AttackActor(Actor actorToAttack, float angle) {
Vector3 particlePos = Vector3.zero;
float weaponAttackPoints = Inventory.Weapon.Points;
// attack was blocked:
if (actorToAttack.IsBlocking && angle < actorToAttack.Inventory.Shield.AttackAngle) {
particlePos = actorToAttack.equippedItemManager.ShieldHolder.Item.transform.position;
Instantiate(ParticleManager.Instance.Sparks, particlePos, Quaternion.identity);
actorToAttack.Block(gameObject, weaponAttackPoints);
if (GetComponent<Player>())
PlayerCamera.Instance.Shake(0.2f, 3, 4);
} else {
particlePos = new Vector3(actorToAttack.transform.position.x, equippedItemManager.WeaponHolder.Item.transform.position.y, actorToAttack.transform.position.z);
Instantiate(ParticleManager.Instance.Blood, particlePos, Quaternion.identity);
actorToAttack.TakeDamage(gameObject, weaponAttackPoints);
if(GetComponent<Player>())
PlayerCamera.Instance.Shake(0.2f, 3, 5);
audioSource.PlayOneShot(AudioManager.Instance.HitActorClip);
audioSource.pitch = UnityEngine.Random.Range(0.8f, 1.2f);
}
}
示例5: OnTriggered
public void OnTriggered(Actor actor) {
if (actor.GetType() == typeof(Player))
actor.TakeDamage(gameObject, playerDamage);
else
actor.TakeDamage(gameObject, aIDamage);
}
示例6: HandleAbility
public void HandleAbility(Actor source, Actor target)
{
target.TakeDamage(GetDamageValue(source), damage_type);
}
示例7: DOAttack
IEnumerator DOAttack(Actor _victim)
{
spriteRenderer.transform.DOKill();
Sequence attackSequence = DOTween.Sequence();
Tween moveToEnemy = spriteRenderer.transform.DOMove(_victim.transform.position, 0.15f);
Tween moveBack = spriteRenderer.transform.DOLocalMove(Vector3.zero, 0.15f);
attackSequence.Append(moveToEnemy).Append(moveBack);
yield return moveToEnemy.WaitForCompletion();
_victim.TakeDamage(baseDamage);
yield return moveBack.WaitForCompletion();
spriteRenderer.transform.localPosition = Vector3.zero;
}