Ejemplo n.º 1
0
        protected override void Attack()
        {
            if (Time.time > nextAttack)
            {
                if (rigging)
                {
                    rigging.SetTrigger("attack");

                    if (sndOnAttack && Random.Range(0f, 1f) > .5f)
                    {
                        listener.PlayOneShot(sndOnAttack, .1f);
                    }
                }
                if (target.gameObject.tag == "Player")
                {
                    LivingEntity entity = target.GetComponent <LivingEntity>();

                    if (entity != null && GetDistanceFromTarget() < maxAttackRange + dammageDistanceOffset)
                    {
                        entity.TakeDirectDamage(damagePerHit);
                    }
                }

                nextAttack = Time.time + (enraged ? attackPerSecond / enrageModifier : attackPerSecond);
            }
        }
Ejemplo n.º 2
0
 void OnTriggerEnter(Collider other)
 {
     if (onAttack)
     {
         if ((m_colliderMask.value & 1 << other.gameObject.layer) == 1 << other.gameObject.layer)
         {
             if (other.CompareTag("BossCocoon"))
             {
                 BossCocoon cocoon = other.GetComponent <BossCocoon>();
                 m_boss.Heal(cocoon.LifeLeach(m_leachAmount * 10));
             }
             else
             {
                 LivingEntity entity = other.GetComponent <LivingEntity>();
                 entity.TakeDirectDamage(m_leachAmount);
                 m_boss.Heal(entity.LastDamage);
             }
         }
     }
 }