void IModule.OnCreate(System.Object param) { _root = new GameObject("[AudioManager]"); UnityEngine.Object.DontDestroyOnLoad(_root); foreach (int value in System.Enum.GetValues(typeof(EAudioLayer))) { EAudioLayer layer = (EAudioLayer)value; _audioSourceWrappers.Add(layer, new AudioSourceWrapper(layer.ToString(), _root.transform)); } }
void IModule.OnCreate(System.Object param) { // 检测依赖模块 if (MotionEngine.Contains(typeof(ResourceManager)) == false) { throw new Exception($"{nameof(AudioManager)} depends on {nameof(ResourceManager)}"); } _root = new GameObject("[AudioManager]"); UnityEngine.Object.DontDestroyOnLoad(_root); foreach (int value in System.Enum.GetValues(typeof(EAudioLayer))) { EAudioLayer layer = (EAudioLayer)value; _audioSourceWrappers.Add(layer, new AudioSourceWrapper(layer.ToString(), _root.transform)); } }