// force play an audio to a source via a name public void ForcePlay(AudioSource _audSrc, string _name) { // if there is an audio clip playing stop it Stop(); // try and run the following try { // find and return the current audio we are playing ClipProperties clip = FindAudioByName(_name); // set the source and play the audio m_externalAudSrc = _audSrc; m_externalAudSrc.clip = clip.audClp; m_externalAudSrc.Play(); m_blnAudioTriggered = true; // display the subtitle uiTextObject.text = clip.subtitle; } catch { // throw a warning Debug.LogError("There has been an error playing your audio clip. Please double check and make sure the VO Bank and Manager is configured correctly."); } }
// play an audio through the default source via a name public void Play(string _name) { // if an audio clip is already playing if (m_blnAudioTriggered) { // return and don't run anything else return; } // else else { // try and run the following try { // find and return the current audio we are playing ClipProperties clip = FindAudioByName(_name); // set the source and play the audio m_audSrc.clip = clip.audClp; m_audSrc.Play(); m_blnAudioTriggered = true; // display the subtitle uiTextObject.text = clip.subtitle; } catch { // throw a warning Debug.LogError("There has been an error playing your audio clip. Please double check and make sure the VO Bank and Manager is configured correctly."); } } }
// add a new empty clip to the bank public void AddEmptyClip() { ClipProperties clipProp = new ClipProperties(); clipProp.id = 0; clipProp.strName = "Clip Name"; clipProp.subtitle = ""; bank.Add(clipProp); }
// add a new clip to the bank public void AddClip(ClipProperties _clipProperties) { bank.Add(new ClipProperties()); }