public void DecreaseCurrentLife() { CurrentHealth -= 1; // If we hit 0. Die. if (CurrentHealth == 0) { OnHealthReachedZero?.Invoke(); } }
public void DecreaseCurrentLife(int amount) { CurrentHealth -= amount; CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth); // If we hit 0. Die. if (CurrentHealth == 0) { OnHealthReachedZero?.Invoke(); } }
public void TakeDamage(int damage) { currentHealth -= damage; Debug.Log(transform.name + " takes " + damage + " damage."); // If we hit 0, Die. if (currentHealth <= 0) { currentHealth = 0; OnHealthReachedZero?.Invoke(); } }