當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。