Пример #1
0
        public bool AlreadyPlayingTheSame(eSoundList sound)
        {
            if (musicAudioSources[0].clip != null)
            {
                return(musicAudioSources[0].clip.name == GetSoundMap(sound).audioClip[0].name);
            }

            return(false);
        }
Пример #2
0
        public SoundMap GetSoundMap(eSoundList sound)
        {
            foreach (SoundMap soundMap in soundMaps)
            {
                if (soundMap.soundType == sound)
                {
                    return(soundMap);
                }
            }

            return(null);
        }
Пример #3
0
        public void PlayMusic(eSoundList sound)
        {
            SoundMap soundMap = GetSoundMap(sound);

            if (soundMap != null && soundMap.audioClip != null)
            {
                AudioSource targetMusicSource = GetFreeMusicSource();

                if (targetMusicSource != null)
                {
                    targetMusicSource.clip = soundMap.audioClip[0];
                    targetMusicSource.PlayDelayed(delay);
                }
            }
        }
Пример #4
0
        public void PlaySound(eSoundList sound)
        {
            SoundMap soundMap = GetSoundMap(sound);

            if (soundMap != null && soundMap.audioClip != null)
            {
                AudioSource targetSoundSource = GetFreeSoundSource();

                if (targetSoundSource != null)
                {
                    targetSoundSource.clip = soundMap.audioClip[0];
                    targetSoundSource.Play();
                }
            }
        }
Пример #5
0
        public void PlaySound(eSoundList sound, int idx)
        {
            SoundMap soundMap = GetSoundMap(sound);

            if (soundMap != null && soundMap.audioClip != null)
            {
                AudioSource targetSoundSource = GetFreeSoundSource();

                if (targetSoundSource != null)
                {
                    if (idx > soundMap.audioClip.Length - 1)
                    {
                        idx = soundMap.audioClip.Length - 1;
                    }
                    targetSoundSource.clip = soundMap.audioClip[idx];
                    targetSoundSource.Play();
                }
            }
        }