Example #1
0
    // 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.");
        }
    }
Example #2
0
    // 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.");
            }
        }
    }
Example #3
0
    // 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);
    }
Example #4
0
 // add a new clip to the bank
 public void AddClip(ClipProperties _clipProperties)
 {
     bank.Add(new ClipProperties());
 }