Exemplo n.º 1
0
        public DGSoundClip PlaySoundByResources(string path, float volume = 1f, DGSoundType type = DGSoundType.Sound_Fx, bool loop = false)
        {
            DGSoundClip sound = new DGSoundClip();

            sound.Volume = volume;
            sound.Type   = type;
            sound.Loop   = loop;
            StartCoroutine(LoadSoundByResources(sound, path));

            return(sound);
        }
Exemplo n.º 2
0
        public IEnumerator PlaySoundByPath(string path, DGSoundType type)
        {
            WWW request = new WWW(path);

            // Wait for download to complete
            yield return(request);

            // use request.audio
            AudioClip loadedMp3 = request.GetAudioClip(false, false);

            DGSoundClip newSound = new DGSoundClip();

            newSound.Audio = loadedMp3;
            newSound.Type  = type;

            PlaySound(newSound);
        }