Ejemplo n.º 1
0
    public async void PlaySound(string name, int delay = 0, float volume = 1f)
    {
        if (Sounds.ContainsKey(name))
        {
            InAudio.SetVolumeForAudioFolder(Sounds [name], volume);



            await Task.Delay(delay);

            if (volume < 1f)
            {
                InAudio.Play(Camera.main.gameObject, Sounds [name], new AudioParameters(volume, Random.Range(0.8f, 1.1f), 0, 1));
            }
            else
            {
                InAudio.Play(Camera.main.gameObject, Sounds [name]);
            }
        }
    }