Example #1
0
    public void ReceiveDamage(float amount)
    {
        if (invincible)
        {
            return;
        }

        health -= amount;

        onDamaged.Invoke(amount);

        if (health <= 0)
        {
            health = 0;
            onKilled.Invoke();
        }
    }
Example #2
0
 public static void SetKilled()
 {
     Killed = true;
     OnKilled.Set();
     KilledEvent?.Invoke();
 }