private void ShipInBase(Collider2D other) { if (_lightSwitchingAudio != null) { _lightSwitchingAudio.Play(); } Destroy(_trailLight); Cursor.visible = false; if (_enterLight != null) { _enterLight.color = _enterLightColor; } _shipInBase = true; ShipInBase shipInBaseScript = other.GetComponent <ShipInBase>(); if (transform.parent.parent != null) { shipInBaseScript.InBase(true, _moveShipToPosition.position, _moveShipRoationZ + transform.parent.parent.rotation.eulerAngles.z, true); } else { shipInBaseScript.InBase(true, _moveShipToPosition.position, _moveShipRoationZ, true); } PlayerGUIScript playerUI = GameManager.CameraObject.GetComponentInChildren <PlayerGUIScript>(); playerUI.gameObject.SetActive(false); // Play sound here, or perhaps in the function EndLevel() StartCoroutine(DockingAnimation()); }
private void Die() { if (!_isDead) { _isDead = true; } GameManager.PlayerKilledReaction(); _deathAudio.Play(); _deathParticles.Play(); ShipInBase turnOffShip = GetComponent <ShipInBase>(); if (turnOffShip != null) { turnOffShip.InBase(true, Vector3.zero); } StartCoroutine(Restart()); }