public void TurnOnVolume(Sound.MixGroupsName groupsName) { GroupsAudio gA = null; foreach (GroupsAudio z in allMixerGroups) { if (z.enumName == groupsName) { gA = z; break; } } gA.audioSource.volume = gA.volume; }
private void Awake() { allMixerGroups = new List <GroupsAudio>(); foreach (AudioMixerGroup z in _audioMixer.FindMatchingGroups("Master")) { GroupsAudio gA = new GroupsAudio(); gA.name = z.name; gA.mixerGroup = z; gA.audioSource = gameObject.AddComponent <AudioSource>(); gA.audioSource.outputAudioMixerGroup = z; gA.enumName = Sound.GetMixGroupsName(z.name); gA.volume = 1; allMixerGroups.Add(gA); } }
public void PlayPlayerSoundEffect(Sound.PlayerEffectList effectSound) { GroupsAudio gA = null; foreach (GroupsAudio z in allMixerGroups) { if (z.enumName == Sound.MixGroupsName.PlayerEffects) { gA = z; break; } } AudioClip aC = Resources.Load("Sound/PlayerEffect/" + effectSound) as AudioClip; gA.audioSource.clip = aC; gA.audioSource.Play(); }
public void PlayMusic(Sound.MusicList musicName) { GroupsAudio gA = null; foreach (GroupsAudio z in allMixerGroups) { if (z.enumName == Sound.MixGroupsName.Music) { gA = z; break; } } AudioClip aC = Resources.Load("Sound/Music/" + musicName) as AudioClip; gA.audioSource.clip = aC; gA.audioSource.loop = true; gA.audioSource.Play(); }