Ejemplo n.º 1
0
        public void PlayAudioEvent(BaseAudioEventInfo baseAudioEvent)
        {
            if (baseAudioEvent == null)
            {
                return;
            }

            if (!(baseAudioEvent is AudioEvent audioEvent))
            {
                // TODO
                return;
            }

            var entry = ResolveAudioEventEntry(audioEvent);

            if (entry == null)
            {
                logger.Warn($"Missing Audio File: {audioEvent.Name}");
                return;
            }

            var source = GetSound(entry, audioEvent.Control.HasFlag(AudioControlFlags.Loop));

            _sources.Add(source);

            source.Volume = (float)audioEvent.Volume;

            source.Play();
        }
Ejemplo n.º 2
0
        public void PlayAudioEvent(BaseAudioEventInfo baseAudioEvent)
        {
            var source = PlayAudioEventBase(baseAudioEvent);

            if (source == null)
            {
                return;
            }

            source.Play();
        }
Ejemplo n.º 3
0
        public AudioSource PlayAudioEvent(BaseAudioEventInfo baseAudioEvent, bool looping = false)
        {
            var source = PlayAudioEventBase(baseAudioEvent, looping);

            if (source == null)
            {
                return(null);
            }

            source.Play();
            return(source);
        }
Ejemplo n.º 4
0
        public void PlayAudioEvent(GameObject emitter, BaseAudioEventInfo baseAudioEvent)
        {
            var source = PlayAudioEventBase(baseAudioEvent);

            if (source == null)
            {
                return;
            }

            // TODO: fix issues with some units
            //_3dengine.SetSourcePosition(source, emitter.Transform.Translation);
            source.Play();
        }
Ejemplo n.º 5
0
        public AudioSource PlayAudioEvent(GameObject emitter, BaseAudioEventInfo baseAudioEvent, bool looping = false)
        {
            var source = PlayAudioEventBase(baseAudioEvent, looping);

            if (source == null)
            {
                return(null);
            }

            // TODO: fix issues with some units
            //_3dengine.SetSourcePosition(source, emitter.Transform.Translation);
            source.Play();
            return(source);
        }
Ejemplo n.º 6
0
        private bool ValidateAudioEvent(BaseAudioEventInfo baseAudioEvent)
        {
            if (baseAudioEvent == null)
            {
                return(false);
            }

            if (!(baseAudioEvent is AudioEvent))
            {
                // TODO
                return(false);
            }

            return(true);
        }
Ejemplo n.º 7
0
        private AudioSource PlayAudioEventBase(BaseAudioEventInfo baseAudioEvent)
        {
            if (!ValidateAudioEvent(baseAudioEvent))
            {
                return(null);
            }

            var audioEvent = baseAudioEvent as AudioEvent;
            var entry      = ResolveAudioEventEntry(audioEvent);

            if (entry == null)
            {
                logger.Warn($"Missing Audio File: {audioEvent.Name}");
                return(null);
            }

            var source = GetSound(entry, audioEvent.SubmixSlider, audioEvent.Control.HasFlag(AudioControlFlags.Loop));

            source.Volume = (float)audioEvent.Volume;
            return(source);
        }