private void OnCollisionEnter2D(Collision2D other) { GameObject objectHit = other.gameObject; DamageController damageController = objectHit.GetComponent <DamageController>(); if (damageController is DamageController) { damageController.takeDamage(damage); this.destroySelf(); } }