LazyBot/Assets/Scripts/Audio/AudioContainer.cs
/// <summary>
/// Plays audio instant or after delay (depends on settings).
/// </summary>
/// <param name="audioName">Audio name to be played.</param>
/// <param name="searchInNested">Search in child containers.</param>
/// <param name="onlyDirect">Only direct childs.</param>
/// <returns>MD5 hash key of audio.</returns>
Plays audio instant or after delay (depends on settings).
Plays audio instant or after delay ( depends on settings ) .
public string Play(string audioName, bool searchInNested = true, bool onlyDirect = true)
        {
            for (int i = 0; i < _audios.Count; i++)
            {
                if (_audios[i].Name == audioName)
                {
                    return Play(i);
                }
            }
            if (!searchInNested) return string.Empty;
            for (int i = 0; i < _containers.Count; i++)
            {
                string audioKey = _containers[i].Play(audioName, !onlyDirect, false);
                if (audioKey != string.Empty)
                    return audioKey;
            }
            return string.Empty;
        }
public string Play ( string audioName , bool searchInNested = true , bool onlyDirect = true ) { for ( int i = 0 ; i < _audios . Count ; i ++ ) { if ( _audios [ i ] . Name == audioName ) { return Play ( i ) ; } } if ( ! searchInNested ) return string . Empty ; for ( int i = 0 ; i < _containers . Count ; i ++ ) { string audioKey = _containers [ i ] . Play ( audioName , ! onlyDirect , false ) ; if ( audioKey != string . Empty ) return audioKey ; } return string . Empty ; }
Plays audio instant or after delay (depends on settings).
Plays audio instant or after delay ( depends on settings ) .
MD5 hash key of audio.
MD5 hash key of audio .
audioName
string
Audio name to be played.
Audio name to be played .
searchInNested
bool
Search in child containers.
Search in child containers .
onlyDirect
bool
Only direct childs.
Only direct childs .