LazyBot/Assets/Scripts/Audio/AudioContainer.cs
/// <summary>
/// Calculates maximum audibility of all active audios.
/// </summary>
/// <param name="source">Position of audio emitter.</param>
/// <param name="listener">Position of listener.</param>
/// <param name="searchInNested">Search in child containers.</param>
/// <param name="onlyDirect">Only direct childs.</param>
/// <returns>Maximum loudness of active audios.</returns>
Calculates maximum audibility of all active audios.
Calculates maximum audibility of all active audios .
public float GetAudibility(Vector3 source, Vector3 listener, bool searchInNested = true, bool onlyDirect = true)
        {
            float noise = 0.0f, noiseT;
            for (int i = 0; i < _audios.Count; i++)
            {
                noiseT = _audios[i].GetAudibility(source, listener);
                if (noiseT > noise) noise = noiseT;
            }
            if (!searchInNested) return noise;
            for (int i = 0; i < _containers.Count; i++)
            {
                noiseT = _containers[i].GetAudibility(source, listener, !onlyDirect, false);
                if (noiseT > noise) noise = noiseT;
            }
            return noise;
        }
public float GetAudibility ( Vector3 source , Vector3 listener , bool searchInNested = true , bool onlyDirect = true ) { float noise = 0.0f , noiseT ; for ( int i = 0 ; i < _audios . Count ; i ++ ) { noiseT = _audios [ i ] . GetAudibility ( source , listener ) ; if ( noiseT > noise ) noise = noiseT ; } if ( ! searchInNested ) return noise ; for ( int i = 0 ; i < _containers . Count ; i ++ ) { noiseT = _containers [ i ] . GetAudibility ( source , listener , ! onlyDirect , false ) ; if ( noiseT > noise ) noise = noiseT ; } return noise ; }
Calculates maximum audibility of all active audios.
Calculates maximum audibility of all active audios .
Maximum loudness of active audios.
Maximum loudness of active audios .
source
Vector3
Position of audio emitter.
Position of audio emitter .
listener
Vector3
Position of listener.
Position of listener .
searchInNested
bool
Search in child containers.
Search in child containers .
onlyDirect
bool
Only direct childs.
Only direct childs .