コード例 #1
0
ファイル: SoundKit.cs プロジェクト: imec-int/arcadeGameJam
    /// <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);
    }
コード例 #2
0
    /// <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);
    }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
    /// <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);
    }