public void TakeDamage() { if (--numberOfLives == 0) { Destroy(healthUISpriteGO[numberOfLives]); Instantiate(deathSoundEffectPrefab); Instantiate(explosionEffectPrefab, transform.position, transform.rotation); backgroundMusicPlayer.Stop(); asteroidWaveManager.DestroyAllAsteroids(true); gameOverMenuController.ShowGameOverPanel(); #if UNITY_ANDROID || UNITY_IOS mobileInputController.SetChildButtonsActive(false); #endif } else { Destroy(healthUISpriteGO[numberOfLives]); healthUISpriteGO.RemoveAt(numberOfLives); StartCoroutine("RespawnCoroutine"); } }
private void Start() { if (oldInstanceToDestroy != null) { if (transferAmbientTime) { ambientAudioSource.timeSamples = oldInstanceToDestroy.ambientAudioSource.timeSamples; } if (transferMusicTime) { musicAudioSource.timeSamples = oldInstanceToDestroy.musicAudioSource.timeSamples; } oldInstanceToDestroy.Stop(); Destroy(oldInstanceToDestroy.gameObject); } }
private void Start() { if (m_OldInstanceToDestroy != null) { if (m_TransferAmbientTime) { m_AmbientAudioSource.timeSamples = m_OldInstanceToDestroy.m_AmbientAudioSource.timeSamples; } if (m_TransferMusictime) { m_MusicAudioSource.timeSamples = m_OldInstanceToDestroy.m_MusicAudioSource.timeSamples; } m_OldInstanceToDestroy.Stop(); Destroy(m_OldInstanceToDestroy.gameObject); } }
private void Start() { //if delete & trasnfer time only in Start so we avoid the small gap that doing everything at the same time in Awake would create if (m_OldInstanceToDestroy != null) { if (m_TransferAmbientTime) { m_AmbientAudioSource.timeSamples = m_OldInstanceToDestroy.m_AmbientAudioSource.timeSamples; } if (m_TransferMusicTime) { m_MusicAudioSource.timeSamples = m_OldInstanceToDestroy.m_MusicAudioSource.timeSamples; } m_OldInstanceToDestroy.Stop(); Destroy(m_OldInstanceToDestroy.gameObject); } }