Пример #1
0
 private void Update()
 {
     m_realVolume = Mathf.Clamp(m_volume * m_parentVolume * m_setVolume, 0f, 1f);
     m_realPitch  = Mathf.Clamp(m_pitch * m_parentPitch * m_setPitch, -3f, 3f);
     for (int i = 0; i < m_hashKeys.Count; i++)
     {
         object obj = m_childComponents[m_hashKeys[i]];
         if (obj is AudioComponent)
         {
             AudioComponent audioComponent = obj as AudioComponent;
             audioComponent.m_parentVolume = m_realVolume;
             audioComponent.m_parentPitch  = m_realPitch;
         }
         if (obj is AudioRandomComponent)
         {
             AudioRandomComponent audioRandomComponent = obj as AudioRandomComponent;
             audioRandomComponent.m_parentVolume = m_realVolume;
             audioRandomComponent.m_parentPitch  = m_realPitch;
         }
         if (obj is AudioRandomSimpleComponent)
         {
             AudioRandomSimpleComponent audioRandomSimpleComponent = obj as AudioRandomSimpleComponent;
             audioRandomSimpleComponent.m_parentVolume = m_realVolume;
             audioRandomSimpleComponent.m_parentPitch  = m_realPitch;
         }
         if (obj is AudioGroupComponent)
         {
             AudioGroupComponent audioGroupComponent = obj as AudioGroupComponent;
             audioGroupComponent.m_parentVolume = m_realVolume;
             audioGroupComponent.m_parentPitch  = m_realPitch;
         }
     }
 }
Пример #2
0
 private void OnEnable()
 {
     audioGroupComponent = base.gameObject.transform.GetComponent <AudioGroupComponent>();
     if (m_loadOnAwake)
     {
         LoadAssets();
     }
 }
Пример #3
0
 public void PopulateVolumes()
 {
     MasterVolume          = AudioBindingManager.Instance.MasterVolume;
     MusicVolume           = AudioBindingManager.Instance.MusicVolume;
     SFXVolume             = AudioBindingManager.Instance.SFXVolume;
     UIVolume              = AudioBindingManager.Instance.UIVolume;
     AmbientVolume         = AudioBindingManager.Instance.AmbientVolume;
     EnvironmentVolume     = AudioBindingManager.Instance.EnvironmentVolume;
     CharacterSoundsVolume = AudioBindingManager.Instance.CharacterSoundsVolume;
     UpgradeBoughtSound    = AudioBindingManager.Instance.UpgradeBoughtSound;
 }
Пример #4
0
 private void RegisterWithParent()
 {
     if (base.transform.parent != null)
     {
         m_parentGroupComponent = base.transform.parent.gameObject.GetComponent <AudioGroupComponent>();
     }
     if ((bool)m_parentGroupComponent && m_parentGroupComponent.RegisterComponent(base.gameObject))
     {
         m_registeredWithParent = true;
     }
 }
Пример #5
0
 private void UnRegisterWithParent()
 {
     m_parentGroupComponent = base.transform.parent.gameObject.GetComponent <AudioGroupComponent>();
     if ((bool)m_parentGroupComponent && m_parentGroupComponent.UnRegisterComponent(base.gameObject))
     {
         m_parentGroupComponent = null;
         m_registeredWithParent = false;
     }
     m_parentRandomComponent = base.transform.parent.gameObject.GetComponent <AudioRandomComponent>();
     if ((bool)m_parentRandomComponent && m_parentRandomComponent.UnRegisterComponent(base.gameObject))
     {
         m_parentRandomComponent = null;
         m_registeredWithParent  = false;
     }
 }
Пример #6
0
    public bool RegisterComponent(GameObject _gameObject)
    {
        AudioComponent component = _gameObject.GetComponent <AudioComponent>();

        if ((bool)component)
        {
            m_childComponents.Add(_gameObject, component);
            m_hashKeys.Add(_gameObject);
            if (!component.m_overrideParentOutput)
            {
                component.m_output = m_output;
            }
            if (!component.m_overrideParentPositioning)
            {
                component.m_positioning = m_positioning;
            }
            return(true);
        }
        AudioRandomComponent component2 = _gameObject.GetComponent <AudioRandomComponent>();

        if ((bool)component2)
        {
            m_childComponents.Add(_gameObject, component2);
            m_hashKeys.Add(_gameObject);
            if (!component2.m_overrideParentOutput)
            {
                component2.m_output = m_output;
            }
            if (!component2.m_overrideParentPositioning)
            {
                component2.m_positioning = m_positioning;
            }
            return(true);
        }
        AudioRandomSimpleComponent component3 = _gameObject.GetComponent <AudioRandomSimpleComponent>();

        if ((bool)component3)
        {
            m_childComponents.Add(_gameObject, component3);
            m_hashKeys.Add(_gameObject);
            if (!component3.m_overrideParentOutput)
            {
                component3.m_output = m_output;
            }
            if (!component3.m_overrideParentPositioning)
            {
                component3.m_positioning = m_positioning;
            }
            return(true);
        }
        AudioGroupComponent component4 = _gameObject.GetComponent <AudioGroupComponent>();

        if ((bool)component4)
        {
            m_childComponents.Add(_gameObject, component4);
            m_hashKeys.Add(_gameObject);
            if (!component4.m_overrideParentOutput)
            {
                component4.m_output = m_output;
            }
            if (!component4.m_overrideParentPositioning)
            {
                component4.m_positioning = m_positioning;
            }
            return(true);
        }
        return(false);
    }