void Start() { sr = GetComponent <SpriteRenderer>(); HealthDamage = GetComponent <HealthDamage>(); SwitchSprite(); SwitchColor(); switchTimer = -80; }
private void OnLostLife(HealthDamage reason) { _grampaAnimator.SetTrigger("LostLife"); if (reason == HealthDamage.SawBird) { _visionAnimator.SetTrigger("Pulse"); } if (_numLivesLost < _lostLifeGrumbles.Length) { _grumblesSource.clip = _lostLifeGrumbles[_numLivesLost]; _grumblesSource.Play(); } _numLivesLost++; }
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(); } }