예제 #1
0
    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;
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
    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();
    }
예제 #4
0
    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();
    }