public static void PlayFX(SFXSounds fxSound, PlayMode playMode = PlayMode.single) { // Q.Utils.QDebug.Log("fxSound " + fxSound); if (CheckIsSFX()) { AudioClip soundClip = Resources.Load <AudioClip>(soundsPath + fxSound.ToString()); instance.PlaySoundWithCallback(soundClip, playMode); } }
public static bool isPlayingFX(SFXSounds fxSound) { foreach (AudioSource audioSource in audioSourcesList) { if (audioSource.clip.name == fxSound.ToString()) { return(true); } } return(false); }
public static void StopSoundFX(SFXSounds clip) { for (int i = 0; i < audioSourcesList.Count; i++) { if (audioSourcesList[i].clip.name == clip.ToString()) { audioSourcesList[i].Stop(); audioClipsList.Remove(audioSourcesList[i].clip); Destroy(audioSourcesList[i]); audioSourcesList.Remove(audioSourcesList[i]); } } }
public static void DontStopThisFX(SFXSounds clip) { for (int i = 0; i < audioSourcesList.Count; i++) { if (audioSourcesList[i].clip.name == clip.ToString()) { continue; } else { audioSourcesList[i].Stop(); audioClipsList.Remove(audioSourcesList[i].clip); Destroy(audioSourcesList[i]); audioSourcesList.Remove(audioSourcesList[i]); --i; } } }