Ejemplo n.º 1
0
    public static void FreeAudio(AudioController au)
    {
        if (!_audioPool.Contains(au))
        {
            au.mAudio.Stop();

            if (au.DestroyEvent != null)
            {
                au.DestroyEvent(au);
            }

            au.name        = c_defAuName;
            au.mClipName   = "";
            au.mAutoDel    = false;
            au.mAudio.clip = null;
            au.StopAllCoroutines();
            au.CancelInvoke();
            au.transform.parent = AudioManager.instance.transform;

            if (!au.gameObject.activeSelf)
            {
                au.gameObject.SetActive(true);
            }

            _audioPool.Push(au);
        }
    }