public void Damage() { //if (_isShieldActive) //{ // DeactivateShield(); // return; //} if (_isShieldActive) { _shieldHits--; if (_shieldHits == 2) { //_shieldPrefab.GetComponentInChildren<Renderer>().material.color = Color.green; //_dissolveEffect.ChangeShieldColour(2); _dissolveEffect.ShieldHit(.4f, 1f); //_uIManager.UpdateShield(_shieldHits); return; } else if (_shieldHits == 1) { // _shieldPrefab.GetComponentInChildren<Renderer>().material.color = Color.red; //_dissolveEffect.ChangeShieldColour(1); _dissolveEffect.ShieldHit(.6f, 1f); //_uIManager.UpdateShield(_shieldHits); return; } else { DeactivateShield(); return; } //if(_shieldHits > 1) //{ // _shieldHits--; // _uIManager.UpdateShield(_shieldHits); // return; //} //else{ // DeactivateShield(); // return; //} } _lives--; _cameraShake.CameraShakeStart(); if (_lives == 2) { _rightEngine.SetActive(true); } else if (_lives == 1) { _leftEngine.SetActive(true); } //_uIManager.UpdateLives(_lives); _healthBar.SetHealth((float)_lives, (float)_maxLives); if (_lives < 1) { _spawnManager.StopSpawning(); _uIManager.GameOverText(); sfx[2].Play(); Destroy(this.gameObject); } }