/// <summary> /// 设置声音辅助器 /// </summary> /// <param name="soundHelper">声音辅助器。</param> public void SetSoundHelper(SoundHelperBase soundHelper) { if (soundHelper == null) { Debug.LogError("要设置的声音辅助器为空"); } m_SoundHelper = soundHelper; }
public SoundManager() { m_SoundGroups = new Dictionary <string, SoundGroup>(); m_SoundsBeingLoaded = new List <int>(); m_SoundsToReleaseOnLoad = new HashSet <int>(); m_ResourceManager = FrameworkEntry.Instance.GetManager <ResourceManager>(); m_LoadAssetCallbacks = new LoadAssetCallbacks(LoadSoundSuccessCallback, LoadSoundDependencyAssetCallback, LoadSoundFailureCallback, LoadSoundUpdateCallback); m_EventManager = FrameworkEntry.Instance.GetManager <EventManager>(); m_SoundHelper = null; m_Serial = 0; m_AudioListener = FrameworkEntry.Instance.gameObject.GetOrAddComponent <AudioListener>(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; }
public SoundAgent(SoundGroup soundGroup, SoundHelperBase soundHelper, SoundAgentHelperBase soundAgentHelper) { if (soundGroup == null) { Debug.LogError("用来构造声音代理对象的声音组为空"); } if (soundHelper == null) { Debug.LogError("用来构造声音代理对象的声音辅助器为空"); } if (soundAgentHelper == null) { Debug.LogError("用来构造声音代理对象的声音代理辅助器为空"); } m_SoundGroup = soundGroup; m_SoundHelper = soundHelper; Helper = soundAgentHelper; Helper.resetSoundAgentEventHandler += OnResetSoundAgent; SerialId = 0; Reset(); }
/// <summary> /// 增加声音代理辅助器 /// </summary> public void AddSoundAgentHelper(SoundHelperBase soundHelper, SoundAgentHelperBase soundAgentHelper) { m_SoundAgents.Add(new SoundAgent(this, soundHelper, soundAgentHelper)); }