public void TakeDamage(int damage) { Health -= damage; healthBar.DecreasingHealth(damage); if (Health <= 0) { if (onPlayerDestroy != null) { onPlayerDestroy(); } Destroy(gameObject, 0.1f); } }
public void TakeDamage(int damage) { if (!DamageSensitive) { damage = 0; } Health -= damage; if (Health <= 0) { Destroy(gameObject, 0.1f); } else { healthBar.DecreasingHealth(damage); } }