public void PlaySound(EAudioClip clip) { if (IsSoundOn) { soundAudioSource.clip = audioClipList[(int)clip]; //Debug.Log("###" + (int)clip); soundAudioSource.Play(); } }
public void PlayClip(EAudioClip clip, float volume, bool loop = false, bool dontDestroy = false) { if (clips[(int)clip] == null) { return; } AudioSource audioSource = gameObject.AddComponent <AudioSource>(); audioSource.loop = loop; audioSource.clip = clips[(int)clip]; audioSource.volume = volume; audioSource.Play(); if (!dontDestroy) { float destroyAfter = clips[(int)clip].length; StartCoroutine(RemoveClip(audioSource, destroyAfter)); } }
public void PlaySoundOnSetting(EAudioClip clip) { soundAudioSource.clip = audioClipList[(int)clip]; soundAudioSource.Play(); }