Ejemplo n.º 1
0
        /// <summary>
        /// Plays a sound with random pitch
        /// </summary>
        /// <param name="sfx">The sound clip you want to play.</param>
        /// <param name="location">The location of the sound.</param>
        /// <param name="volume"></param>
        /// <param name="randomPitchRange">A range to be played between the pitch</param>
        /// <param name="loop">If set to true, the sound will loop.</param>
        /// <param name="minDistance"></param>
        /// <param name="maxDistance"></param>
        /// <param name="delay"></param>
        public void PlaySoundRandomPitch(AudioClip sfx, Vector3 location, float volume = 1f, float randomPitchRange = .1f, bool loop = false, float minDistance = 1f, float maxDistance = 4f, float delay = 0f)
        {
            if (!m_CurrentInGamePooler)
            {
                return;
            }

            var sound = new SoundItem(sfx, inGameAudioMixer, volume, randomPitchRange, 1f, loop, minDistance, maxDistance, AudioRolloffMode.Linear);

            m_CurrentInGamePooler.Trigger(SOUND_OBJECT_POOL, location, delay, sound);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Plays a sound effect with random pitch without taking position into account. Also, sound is not destroyed on scene load,
        /// as long as the SoundManager isn't destroyed either.
        /// </summary>
        /// <param name="sfx">Sound Effect to be played.</param>
        /// <param name="volume"></param>
        /// <param name="randomPitchRange">A range to be played between the pitch</param>
        /// <param name="loop"></param>
        /// <param name="delay">Delay time waited before playing.</param>
        public void PlayNonDiegeticRandomPitchSound(AudioClip sfx, float volume = 1f, float randomPitchRange = .1f, bool loop = false, float delay = 0f)
        {
            var sound = new SoundItem(sfx, uiAudioMixer, volume, randomPitchRange, 0f, loop);

            m_SoundsPool.Trigger(SOUND_OBJECT_POOL, Vector3.zero, delay, sound);
        }