public void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (isBoss) { ShipHealth playerHp = collision.GetComponent <ShipHealth>(); if (!playerHp.getInvincibleStatus()) { collision.GetComponent <PlayerDamageable>().TakeDamage(damage); spawnParticle(); Destroy(gameObject); } } else { collision.GetComponent <PlayerDamageable>().TakeDamage(damage); spawnParticle(); Destroy(gameObject); } } }