Beispiel #1
0
    public void Pause(GameObject _parentGameObject)
    {
        m_looping = false;
        StopCoroutine(Loop(_parentGameObject));
        IDictionaryEnumerator enumerator = m_childComponents.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                DictionaryEntry dictionaryEntry = (DictionaryEntry)enumerator.Current;
                if (dictionaryEntry.Value is AudioComponent)
                {
                    AudioComponent audioComponent = dictionaryEntry.Value as AudioComponent;
                    audioComponent.Pause(_parentGameObject);
                }
                if (dictionaryEntry.Value is AudioRandomComponent)
                {
                    AudioRandomComponent audioRandomComponent = dictionaryEntry.Value as AudioRandomComponent;
                    audioRandomComponent.Pause(_parentGameObject);
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
        private void UpdateFabricPauseState(Component[] components, bool pause)
        {
            if (components == null)
            {
                return;
            }
            int i = 0;

            for (int num = components.Length; i < num; i++)
            {
                Component component = components[i];
                if (component != null)
                {
                    UpdateFabricPauseState(component.GetChildComponents(), pause);
                    AudioComponent audioComponent = component as AudioComponent;
                    if (audioComponent != null)
                    {
                        audioComponent.Pause(pause);
                    }
                }
            }
        }