Esempio n. 1
0
    public static void PlayAudioOneShot(AudioSource audioSource, int soundId, float volume = 1f)
    {
        if (_globalAudioVolume <= 0 || _audioVolume <= 0)
        {
            return;
        }

        SoundDeploy deploy = _soundTableT.GetSection(soundId);

        if (!deploy || string.IsNullOrEmpty(deploy.resource))
        {
            return;
        }

        AudioClip resource;

        if (CachePool.TryGetValue(deploy.resource, out resource))
        {
            PlayAudioOneShot(audioSource, resource, volume, deploy.volume);
        }
        else
        {
            RLoadPlayAudioOneShot(deploy.resource, audioSource, volume, deploy.volume);
        }
    }
Esempio n. 2
0
    private static void LoadPlayAudio(string soundName, AudioSource audioSource, float volume, bool loop, Action playCallBack)
    {
        AudioClip resource;

        if (CachePool.TryGetValue(soundName, out resource))
        {
            DoPlayAudio(audioSource, resource, volume, loop, playCallBack);
        }
        else
        {
            RLoadPlayAudio(soundName, audioSource, volume, loop, playCallBack);
        }
    }