private Task HealthUpdate(int health) { if (debug) { Console.WriteLine($"OBSERVER: NetworkManagerClient HealthUpdate"); } HealthUpdated?.Invoke(health); return(Task.CompletedTask); }
private void OnHealthUpdated() { HealthUpdated?.Invoke(); progressBar.BarValue = Health; if (Health < maxHealth) { return; } OnCarRepaired(); }
public void Damage(int amount) { var newHp = health - amount; if (newHp < 0) { newHp = 0; } HealthUpdated?.Invoke(this, newHp); health = newHp; if (health <= 0) { Kill(); } }
private void FixedUpdate() { OnHealthUpdated?.Invoke(currentHealth); }