public void TakeDamage(float amount) { currentHealth -= amount; currentHealth = Mathf.Max(0, currentHealth); currentCellNumber = Mathf.CeilToInt(currentHealth / healthPerCell); if (damageIndicator) { damageIndicator.Trigger(); } if (currentHealth == 0) { Destroy(); } if (currentCellNumber != previousCellNumber) { healthBar.ToggleOnOff(totalHPCell - currentCellNumber, 0, false); } }