Exemple #1
0
    public void TakeDamage(int dmg)
    {
        if (bCanTakeDamage)
        {
            StartCoroutine(InvulnWait());
            hitsRemain--;
            Ev_UpdateHpBar?.Invoke((float)hitsRemain / maxHitHealth);

            if (hitsRemain == 0)
            {
                Die();
            }
        }
    }
Exemple #2
0
    public void TakeDamage(int amount)
    {
        if (amount <= 0)
        {
            throw new ArgumentOutOfRangeException("Invalid Damage amount specified: " + amount);
        }

        currentHp -= amount;

        Ev_UpdateHpBar?.Invoke((float)currentHp / startingHp);

        if (currentHp <= 0)
        {
            Die();
        }
    }
Exemple #3
0
 internal void UpdateHpBar()
 {
     Ev_UpdateHpBar?.Invoke((float)currentHp / maxHp);
 }