/// <summary>
    /// Plays a sound effect
    /// </summary>
    /// <param name="Id">Id of the sound effect in the catalog</param>
    /// <param name="source">AudioSource where the sound will come from. Null to generate a temporary one</param>
    /// <param name="loop">Is the sound looped?</param>
    /// <param name="finished">Specify a method you want to be invoked when the sound finished playing</param>
    public void PlaySfx(string Id, AudioSource source, bool loop, GameManager.GameEvent finished)
    {
        if (!string.IsNullOrEmpty(Id))
        {
            AudioCatalog.IndexedClipList clip = findSfxInCatalogs(Id);
            AudioClip aClip = null;
            if (clip != null)
            {
                //decide which audio clip to play
                if ((clip.Clips != null) && (clip.Clips.Length > 0))
                {
                    //select a random clip from the ones available
                    aClip = clip.Clips[Random.Range(0, clip.Clips.Length)];
                }
                else
                {
                    Debug.LogError(string.Format("SFX {0} does not contains any AudioClips!", Id));
                }

                bool asCreated = false;
                if (aClip != null)
                {
                    //if no AudioSource was specified, create a new one
                    if (source == null)
                    {
                        GameObject gO = GetAudioObject(Id);
                        source    = gO.GetComponent <AudioSource>();
                        asCreated = true;
                    }

                    //Add the sound to the sounds being played
                    PlayingSound pS = new PlayingSound();
                    pS.Source          = source;
                    pS.DestroyOnFinish = asCreated;
                    pS.Looped          = loop;
                    pS.Finished        = finished;
                    pS.Id          = Id;
                    pS.InmediateCC = clip.InmediateCC;
                    pS.recycle     = asCreated;
                    this.playingSounds.Add(pS);

                    //TODO: Soporte de Closed Captions

                    //actually play the sound
                    source.clip   = aClip;
                    source.loop   = loop;
                    source.volume = GameManager.Instance.Options.Options.SfxVolume;
                    source.Play();
                }
            }
            else
            {
                Debug.LogError(string.Format("SFX {0} not defined in any AudioCatalog!", Id));
            }
        }
    }
 /// <summary>
 /// Searchs for a Sfx in all the catalogs currently in memory
 /// </summary>
 private AudioCatalog.IndexedClipList findSfxInCatalogs(string Id)
 {
     AudioCatalog.IndexedClipList retVal = null;
     for (int i = 0; i < this.audioCatalogs.Length; i++)
     {
         AudioCatalog.IndexedClipList c = this.audioCatalogs[i].GetSfx(Id);
         if (c != null)
         {
             retVal = c; break;
         }
     }
     return(retVal);
 }