当前位置: 首页>>代码示例>>C#>>正文


C# Actor.TakeDamage方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:JelleDekkers,项目名称:AfstudeerProject,代码行数:7,代码来源:Fire.cs

示例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);
    }
开发者ID:JelleDekkers,项目名称:AfstudeerProject,代码行数:18,代码来源:Spikes.cs

示例3: OnRemove

 public void OnRemove(Actor actor)
 {
     actor.TakeDamage(dmg, "true", 0);
 }
开发者ID:kevinwegner,项目名称:ConsoleDungeonCrawler,代码行数:4,代码来源:HeavyInjuryTrait.cs

示例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);
     }
 }
开发者ID:JelleDekkers,项目名称:AfstudeerProject,代码行数:20,代码来源:Actor.cs

示例5: OnTriggered

 public void OnTriggered(Actor actor) {
     if (actor.GetType() == typeof(Player))
         actor.TakeDamage(gameObject, playerDamage);
     else
         actor.TakeDamage(gameObject, aIDamage);
 }
开发者ID:JelleDekkers,项目名称:AfstudeerProject,代码行数:6,代码来源:Grinder.cs

示例6: HandleAbility

 public void HandleAbility(Actor source, Actor target)
 {
     target.TakeDamage(GetDamageValue(source), damage_type);
 }
开发者ID:hiafi,项目名称:Depths,代码行数:4,代码来源:Ability.cs

示例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;
 }
开发者ID:DanielSnd,项目名称:opensfridaygame,代码行数:12,代码来源:Actor.cs


注:本文中的Actor.TakeDamage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。