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(); } }
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); }
public void LoseLife(int amount, Card source) { LifeTotal -= amount; LostLife?.Invoke(this, source, amount); }