protected virtual void OnCollisionEnter2D(Collision2D col) { collisionBehaviour(col); IDamagable hp = col.gameObject.GetComponent <IDamagable> (); if (hp != null) { hp.ChangeHealth(-damage); } }
void CheckIfInBlackHoleVicinity(Collider2D other) { if (Vector3.Distance(transform.position, other.transform.position) <= killDistance) { IDamagable HP = other.GetComponent <IDamagable> (); if (HP != null) { HP.ChangeHealth(-10000); } } }