LazyBot/Assets/Scripts/Audio/AudioContainer.cs
/// <summary>
/// Plays audio instant or after delay (depends on settings).
/// </summary>
/// <param name="index">Index of audio.</param>
/// <param name="playTime">Playback time.</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 ) .
private string Play(int index, float playTime)
        {
            if ((index < 0) ||
                (index >= _audios.Count))
                return string.Empty;
            string audioKey = _audios[index].InitializeAudioSource(gameObject);
            if (audioKey == string.Empty)
                return string.Empty;
            _audios[index].Play(audioKey);
            RunLater(
                () => _audios[index].DestroyAudioSource(audioKey),
                _audios[index].PlayDelay + ((playTime < _audios[index].AudioLength) ? playTime : _audios[index].AudioLength)
            );
            return audioKey;
        }
private string Play ( int index , float playTime ) { if ( ( index < 0 ) || ( index >= _audios . Count ) ) return string . Empty ; string audioKey = _audios [ index ] . InitializeAudioSource ( gameObject ) ; if ( audioKey == string . Empty ) return string . Empty ; _audios [ index ] . Play ( audioKey ) ; RunLater ( ( ) => _audios [ index ] . DestroyAudioSource ( audioKey ) , _audios [ index ] . PlayDelay + ( ( playTime < _audios [ index ] . AudioLength ) ? playTime : _audios [ index ] . AudioLength ) ) ; return audioKey ; }
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 .
index
int
Index of audio.
Index of audio .
playTime
float
None