Example #1
0
 public virtual ExperienceResource[] GetResource(ResourceType resourceType, string category)
 {
     if (resourceType == ResourceType.AUDIO)
     {
         return(m_commonResource.GetResource(resourceType, category));
     }
     else
     {
         return(null);
     }
 }
Example #2
0
        private void PreviewSound(float volume, AudioType audioType)
        {
            if (Pair == null && m_uiEngine.ActiveModule != InputModule.STANDALONE)
            {
                return;
            }

            if (Pair != null && m_uiEngine.ActiveModule != InputModule.OCULUS)
            {
                return;
            }

            var audioSource = m_audio.GetAudioSource(audioType);

            if (audioSource.isPlaying)
            {
                audioSource.volume = volume;
                return;
            }

            var sampleSounds = m_commonResource.GetResource(GetResourceType(audioType), SampleSound);

            if (sampleSounds == null || sampleSounds.Length == 0)
            {
                return;
            }

            AudioClip sampleClip = ((AudioResource)sampleSounds[0]).Clip;
            AudioArgs args       = new AudioArgs(sampleClip, audioType)
            {
                FadeTime = 0
            };

            m_audio.Play(args);
            if (audioType == AudioType.SFX)
            {
                audioSource.loop = true;
            }

            m_playingSampleType = audioType;
        }