Example #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <HealtBar>())
     {
         HealtBar damage = other.GetComponent <HealtBar>();
         damage.GiveDamage(2);
     }
 }
Example #2
0
    private void Attack()
    {
        chillTime = delay;
        HealtBar damage = player.GetComponent <HealtBar>();

        damage.GiveDamage(1);
        if (damage.GetHealth() == 0)
        {
            StopFollowPlayer();
            animator.SetBool("killing", false);
        }
    }