Exemplo n.º 1
0
        public static AudioCase PlaySmartSound(AudioClip clip, AudioType type = AudioType.Sound)
        {
            if (clip == null)
            {
                Debug.LogError("[AudioController]: Audio clip is null");
            }

            AudioSource source = instance.GetAudioSource();

            SetSourceDefaultSettings(source, type);

            AudioCase audioCase = new AudioCase(clip, source, type);

            audioCase.Play();

            AddSound(source);

            return(audioCase);
        }
Exemplo n.º 2
0
        public static AudioCase PlaySmartMusic(AudioClip clip, float volumePercentage = 1.0f)
        {
            if (clip == null)
            {
                Debug.LogError("[AudioController]: Audio clip is null");
            }

            AudioSource source = instance.GetAudioSource();

            SetSourceDefaultSettings(source, AudioType.Music);

            source.volume *= volumePercentage;
            source.clip    = clip;

            AudioCase audioCase = new AudioCase(clip, source, AudioType.Music);

            audioCase.Play();

            AddMusic(source);

            return(audioCase);
        }