private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { if (name == "Death Floor") { AudioSource _playerFallingSource = GameObject.FindGameObjectWithTag("AudioController").transform .Find("PlayerFalling").GetComponent <AudioSource>(); _playerFallingSource.pitch = _falldownPitch; _playerFallingSource.volume = _falldownVolume; _playerFallingSource.Play(); _controller = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AmbientAudioController>(); _controller.RemoveRopesThisLife(); } LoadLevel(); } if (gameObject.CompareTag("Player") && other.CompareTag("Rock")) { _controller = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AmbientAudioController>(); _controller.RemoveRopesThisLife(); GetComponentInParent <AudioSource>().PlayOneShot(_hurtSound, _hurtVolume); LoadLevel(); } }
private IEnumerator ChangeLevelAfterFade(int sceneIndex) { _fadeAnimator.SetBool("FadeIn", true); _textToDeactivate.SetActive(false); _controller = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AmbientAudioController>(); _controller.ResetRopesThisLife(); yield return(new WaitUntil(() => _canvasGroup.alpha >= 1)); SceneManager.LoadScene(sceneIndex); }