public void Damage() { _cameraShake.ActivateCameraShake(); if (_shieldActive) { if (_shieldLives < 1) { _shieldActive = false; _shieldsVisualizer.SetActive(false); } else { _shieldLives--; if (_shieldLives == 1) { _shieldsVisualizer.GetComponent <SpriteRenderer>().color = Color.green; } if (_shieldLives == 0) { _shieldsVisualizer.GetComponent <SpriteRenderer>().color = Color.red; } } } else { _lives--; if (_lives == 2) { _rightEngineVisualizer.SetActive(true); } if (_lives == 1) { _leftEngineVisualizer.SetActive(true); } _uiManager.UpdateLive(_lives); if (_lives < 1) { Instantiate(_explosionPrefab, transform.position, Quaternion.identity); _spawnManager.OnEndGame(); Destroy(this.gameObject); } } }