/// <summary> /// loops the AudioClip. Do note that you are responsible for calling either stop or fadeOutAndStop on the SKSound /// or it will not be recycled /// </summary> /// <returns>The sound looped.</returns> /// <param name="audioClip">Audio clip.</param> public SKSound playSoundLooped(AudioClip audioClip) { // find the first SKSound not being used. if they are all in use, create a new one SKSound sound = nextAvailableSound(); sound.playAudioClip(audioClip, soundEffectVolume, 1f, 0f); sound.setLoop(true); return(sound); }
/// <summary> /// loops the AudioClip. Do note that you are responsible for calling either stop or fadeOutAndStop on the SKSound /// or it will not be recycled /// </summary> /// <returns>The sound looped.</returns> /// <param name="audioClip">Audio clip.</param> public SKSound playSoundLooped(AudioClip audioClip, SoundType soundType = SoundType.SFX) { // find the first SKSound not being used. if they are all in use, create a new one SKSound sound = nextAvailableSound(); sound.playAudioClip(audioClip, getVolume(soundType), 1f, 0f, soundType); sound.setLoop(true); return(sound); }
/// <summary> /// loops the AudioClip. Do note that you are responsible for calling either stop or fadeOutAndStop on the SKSound /// or it will not be recycled /// </summary> /// <returns>The sound looped.</returns> /// <param name="audioClip">Audio clip.</param> public SKSound playSoundLooped(AudioClip audioClip) { if (audioClip == null) { Debug.LogWarning("playSoundLooped was called with a null AudioClip."); return(null); } // find the first SKSound not being used. if they are all in use, create a new one SKSound sound = nextAvailableSound(); sound.playAudioClip(audioClip, soundEffectVolume, 1f, 0f, sfxGroup); sound.setLoop(true); return(sound); }
/// <summary> /// loops the AudioClip. Do note that you are responsible for calling either stop or fadeOutAndStop on the SKSound /// or it will not be recycled /// </summary> /// <returns>The sound looped.</returns> /// <param name="audioClip">Audio clip.</param> public SKSound PlaySoundLooped(AudioClip audioClip) { if (audioClip == null) { Debug.LogError("Null sound played"); return(null); } // find the first SKSound not being used. if they are all in use, create a new one SKSound sound = NextAvailableSound(); sound.playAudioClip(audioClip, SoundVolume, 1f, 0f); sound.setLoop(true); return(sound); }