Exemplo n.º 1
0
    private void LoseLife(HealthDamage reason)
    {
        _numLives -= 1;

        if (_numLives < 0)
        {
            return;
        }

        _healthText.text = string.Format("Lives: {0} {1}", _numLives, _lives[_numLives]);
        LostLife?.Invoke(reason);

        if (_numLives == 0)
        {
            EndGame();
        }
    }
Exemplo n.º 2
0
        public void SubtractLives(int liveSubtraction, DamageChangeInfo info)
        {
            if (CurrentLives == 0)
            {
                Debug.Log("Damageable - Finished");
                Finished?.Invoke(info);
            }

            info.oldLives = CurrentLives;

            CurrentLives -= Mathf.Abs(liveSubtraction);
            CurrentLives  = Mathf.Clamp(CurrentLives, 0, maxLives);

            info.newLives = CurrentLives;

            if (CurrentLives == 0)
            {
                Debug.Log("Damageable - Finished");
                Finished?.Invoke(info);
            }

            LivesChanged?.Invoke(info);
            LostLife?.Invoke(info);
        }
Exemplo n.º 3
0
 public void LoseLife(int amount, Card source)
 {
     LifeTotal -= amount;
     LostLife?.Invoke(this, source, amount);
 }