Beispiel #1
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);
                }
            }
        }
Beispiel #2
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();
                }
            }
        }
Beispiel #3
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();
                }
            }
        }