Esempio n. 1
0
    /// <summary>
    /// plays the AudioClip with the specified volumeScale, pitch and pan
    /// </summary>
    /// <returns>The sound.</returns>
    /// <param name="audioClip">Audio clip.</param>
    /// <param name="volume">Volume.</param>
    /// <param name="pitch">Pitch.</param>
    /// <param name="pan">Pan.</param>
    public SKSound playSound(AudioClip audioClip, float volumeScale, float pitch, float pan, 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, volumeScale * getVolume(soundType), pitch, pan, soundType);

        return(sound);
    }
Esempio n. 2
0
    /// <summary>
    /// plays the AudioClip with the specified volumeScale, pitch and pan
    /// </summary>
    /// <returns>The sound.</returns>
    /// <param name="audioClip">Audio clip.</param>
    /// <param name="volume">Volume.</param>
    /// <param name="pitch">Pitch.</param>
    /// <param name="pan">Pan.</param>
    public SKSound playSound(AudioClip audioClip, float volumeScale, float pitch, float pan)
    {
        // Find the first SKSound not being used. if they are all in use, create a new one
        SKSound sound = nextAvailableSound();

        sound.playAudioClip(audioClip, volumeScale * soundEffectVolume, pitch, pan);

        return(sound);
    }
Esempio n. 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)
    {
        // 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);
    }
Esempio n. 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, 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);
    }
Esempio n. 5
0
        /// <summary>
        /// plays the AudioClip with the specified volumeScale, pitch and pan
        /// </summary>
        /// <returns>The sound.</returns>
        /// <param name="audioClip">Audio clip.</param>
        /// <param name="volume">Volume.</param>
        /// <param name="pitch">Pitch.</param>
        /// <param name="pan">Pan.</param>
        public SKSound playSound(AudioClip audioClip, float volumeScale, float pitch, float pan)
        {
            if (audioClip == null)
            {
                Debug.LogWarning("playSound 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, volumeScale * soundEffectVolume, pitch, pan, sfxGroup);

            return(sound);
        }
Esempio n. 6
0
    /// <summary>
    /// plays the AudioClip with the specified volumeScale, pitch and pan
    /// </summary>
    /// <returns>The sound.</returns>
    /// <param name="audioClip">Audio clip.</param>
    /// <param name="volume">Volume.</param>
    /// <param name="pitch">Pitch.</param>
    /// <param name="pan">Pan.</param>
    public SKSound PlaySound(AudioClip audioClip, float volumeScale, float pitch, float pan)
    {
        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, volumeScale * SoundVolume, pitch, pan);

        return(sound);
    }
Esempio n. 7
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);
        }
Esempio n. 8
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);
    }