void Start() { if (sfxPlayer.CompareTag("SFX")) { addButtonListeners(); SceneManager.sceneLoaded += OnSceneLoaded; } }
// Call to manually recycle and disable a GameObject with an AudioSource component. // Call this when you want to completely stop playing a continuous AudioSource. // DO NOT TRY TO USE THE AUDIOSOURCE OR THE GAMEOBJECT IT IS ATTACHED TO AFTER CALLING THIS. public void recycleAudioSource(AudioSource aSource, float fadeOutTime = 0f) { if (aSource.CompareTag(audioObjectTag)) { StartCoroutine(audioFadeOut(aSource, fadeOutTime)); } else { Debug.LogWarning("recycleAudioSource was called for an AudioSource GameObject that isn't tagged with " + audioObjectTag + ". Please only use AudioSources created by the SoundFXPlayer as parameters for recycleAudioSource function."); } }
public void Die() { if (isDead) { return; } isDead = true; audio.AudioActivation(source); ToggleRagdoll(true); if (source.CompareTag("Player")) { GameManager.singleton.GameOver(); } }