private void SetHealth(float newHealth) { if (CheckIfNumberIsPercent(newHealth)) { _healthLevel = newHealth; HealthChanged?.Invoke(this, new ValueChangedEventArgs(newHealth)); } if (Health == GameConstants.HelthDeathLimit) { PetDied?.Invoke(this, EventArgs.Empty); } }
private void SetAge(float newAge) { if (newAge > _age) { var previousAge = _age; _age = newAge; AgeChanged?.Invoke(this, new AgeChangedEventArgs(previousAge, newAge)); } if (Age == _lifeDuration) { PetDied?.Invoke(this, EventArgs.Empty); } }