public virtual void OnTriggerEnter2D(Collider2D collider) { AbstractClass ac = collider.GetComponent <AbstractClass> (); if (ac) { ac.damage(damage, AbstractDamageCollider.DamageType.light, knockback); destroy(); } }
public void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject == _target && collider.tag != "AllyHazard") { // Only damage the target. AbstractClass ac = collider.GetComponent <AbstractClass> (); if (ac) { ac.damage(_damage, AbstractDamageCollider.DamageType.medium, _knockback); _anim.SetTrigger("Die"); parrotState = ParrotState.die; } } }