//Destroy The public void DestroyBGMSoundFunction() { isBGMSound isBGMSound = FindObjectOfType <isBGMSound>(); if (isBGMSound) { Destroy(isBGMSound.gameObject); } else { Debug.LogWarning("This Object isn't have isBGMSound Objects"); } }
public void PausingBGMSoundFunction() { isBGMSound isBGMSound = FindObjectOfType <isBGMSound>(); if (isBGMSound) { AudioSource localAudioSources = isBGMSound.GetComponent <AudioSource>(); if (localAudioSources.isPlaying) { localAudioSources.Pause(); } } }
//Change BGM Sound public void ChangeBGMSoundFunction() { isBGMSound isBGMSound = FindObjectOfType <isBGMSound>(); if (isBGMSound != null) { AudioSource localAudioSources = isBGMSound.GetComponent <AudioSource>(); localAudioSources.Stop(); localAudioSources.clip = newClip; localAudioSources.Play(); } else { InstantiateNewObjectFunction(newClip);; } }
//PlayBGMSound public void PlayBGMSoundFunction() { isBGMSound isBGMSound = FindObjectOfType <isBGMSound>(); if (isBGMSound != null) { AudioSource localAudioSources = isBGMSound.GetComponent <AudioSource>(); if (!localAudioSources.isPlaying) { localAudioSources.Play(); } } else { InstantiateNewObjectFunction(mainSoundAudioClip); } }