Ejemplo n.º 1
0
        private void Start()
        {
            _soundEvent          = SoundAccess.GetInstance().RetrieveSoundEvent(key);
            _soundEventInstances = new List <SoundEventInstance>();

            for (int i = 0; i < _soundEvent.audioClips.Count; i++)
            {
                _soundEventInstances.Add(SoundEventInstanceManager.GetInstance().CreateSoundEventInstance(gameObject, _soundEvent));
            }

            foreach (SoundEventInstance soundEventInstance in _soundEventInstances)
            {
                soundEventInstance.SetVolume(0);
            }

            if (playOnStart)
            {
                CrossFadeTo(0, 0);
            }
        }
Ejemplo n.º 2
0
        public void Play()
        {
            SoundEvent soundEvent = SoundAccess.GetInstance().RetrieveSoundEvent(key);

            RemoveOldEventInstanceIfKeyHasChanged();

            if (!SoundEventInstanceManager.GetInstance().IsAllowedToPlay(soundEvent))
            {
                return;
            }

            if (_soundEventInstance)
            {
                _soundEventInstance.Play();
                return;
            }

            _soundEventInstance = SoundEventInstanceManager.GetInstance().CreateSoundEventInstance(gameObject, soundEvent);
            _soundEventInstance.Play();
        }
Ejemplo n.º 3
0
 public void OnValueChange(float valueBetween0And1)
 {
     SoundAccess.GetInstance().ApplyVolume(audioMixerGroup.name, valueBetween0And1);
 }
Ejemplo n.º 4
0
 private void Start()
 {
     GetComponent <Slider>().value = SoundAccess.GetInstance().RetrieveVolume(audioMixerGroup.name);
 }