Ejemplo n.º 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (isAttacking)
     {
         ITakeDamage health = other.gameObject.GetComponent <ITakeDamage>();
         if (health != null)
         {
             health.OnDamageTaken(damage);
         }
     }
 }
Ejemplo n.º 2
0
    protected virtual void OnTriggerEnter(Collider other)
    {
        ITakeDamage target = other.gameObject.GetComponent <ITakeDamage>();

        if (target != null)
        {
            target.OnDamageTaken(damage);
        }
        rigid.velocity   = Vector3.zero;
        rigid.useGravity = true;
        trail.enabled    = false;
    }