private Task HealthUpdate(int health)
 {
     if (debug)
     {
         Console.WriteLine($"OBSERVER: NetworkManagerClient HealthUpdate");
     }
     HealthUpdated?.Invoke(health);
     return(Task.CompletedTask);
 }
Пример #2
0
    private void OnHealthUpdated()
    {
        HealthUpdated?.Invoke();
        progressBar.BarValue = Health;

        if (Health < maxHealth)
        {
            return;
        }

        OnCarRepaired();
    }
Пример #3
0
    public void Damage(int amount)
    {
        var newHp = health - amount;

        if (newHp < 0)
        {
            newHp = 0;
        }
        HealthUpdated?.Invoke(this, newHp);

        health = newHp;
        if (health <= 0)
        {
            Kill();
        }
    }
Пример #4
0
 private void FixedUpdate()
 {
     OnHealthUpdated?.Invoke(currentHealth);
 }