static public void RemoveSoundGroup(string _key) { if (!Instance.audioGroup.ContainsKey(_key)) { return; } AudioGroup tg = Instance.audioGroup[_key]; GameObject.Destroy(tg.gameObject); ClearDestoryedSound(); }
static public void AddAudioSoundGroup(string _key, bool _useMixer = false) { if (Instance.audioGroup.ContainsKey(_key)) { return; } GameObject tkeyobj = new GameObject(_key + "-Object"); tkeyobj.transform.SetParent(Instance.groupAudioSoundObject.transform); AudioGroup tlist = new AudioGroup(tkeyobj, Instance.mMaxSoundCount, _useMixer); tlist.Volume = SoundVolume; Instance.audioGroup.Add(_key, tlist); Instance.audioSources.AddRange(tlist.AudioList); }
private void Init() { if (isInit) { return; } isInit = true; mBackMusic = gameObject.AddComponent <AudioSource>(); mixerSoundsObject = new GameObject("mixerSoundsObject"); mixerSoundsObject.transform.SetParent(transform); soundsObject = new GameObject("soundsObject"); soundsObject.transform.SetParent(transform); groupAudioSoundObject = new GameObject("groupAudioSoundObject"); groupAudioSoundObject.transform.SetParent(transform); mAudioMixerSounds = new AudioGroup(mixerSoundsObject, mMaxSoundCount, true); mAudioSounds = new AudioGroup(soundsObject, mMaxSoundCount, false); audioSources.AddRange(mAudioMixerSounds.AudioList); audioSources.AddRange(mAudioSounds.AudioList); }