Exemple #1
0
        public void InitAudioManager()
        {
            _sound = prefabSound.Clone <WSound>(transform);
            Assert.Null <WSound>(_sound);

            // on init, load all the sfx in the path defined
            AudioClip[] audioClipsFromResources = Resources.LoadAll <AudioClip>(path);
            for (int i = 0; i < audioClipsFromResources.Length; ++i)
            {
                _audioClips.Add(audioClipsFromResources[i].name, audioClipsFromResources[i]);
            }

            // init sound
            _sound.InitSound();
        }
Exemple #2
0
        public void InitAudioManager()
        {
            if (isPreLoad)
            {
                AudioClip[] audioClips = Resources.LoadAll <AudioClip>(path);
                for (int i = 0; i < audioClips.Length; ++i)
                {
                    _audioClips.Add(audioClips[i].name, audioClips[i]);
                }
            }

            for (int i = 0; i < sfxChannel; ++i)
            {
                WSound sound = prefabSound.Clone <WSound>(transform);
                sound.InitSound();
                sound.OnDeactivated += () => _currentPlaying.RemoveAll(x => x.Same(sound));

                _sources.Add(sound);
            }

            Volume = 1f;
        }