public void setPlayerDamage(int newDamage) { // if the shields are not on then just dammage // the player like normal if player is hit. if (_areShieldsEnabled == false) { _playerDammage += newDamage; // get a reference to the UI_Manager and // call display lives _damage = _hullIntegrity - _playerDammage; _uiManager.displayPlayerLives(_damage); playEngineDammage(_damage); // If this player takes too much dammage // then destroy this player. if (_playerDammage >= _hullIntegrity) { // have something end this game // and display game over. // loop back to the title screen. _spawnManager.setPlayerDead(); // make player explode sound _explosionSound.Play(); _uiManager.flashGameOver(); // This has to be last because // once this is called. Its null. Destroy(this.gameObject); } } else if (_areShieldsEnabled == true) { // tell the shields prefab to destroy itself destroyShields(); return; } }