Exemplo n.º 1
0
        private async void SetAloneSprite(Image image, string key)
        {
            var sprite = await _spriteCache.GetItem(key);

            var color = image.color;

            image.color = new Color(1, 1, 1, 0);
            if (image != null)
            {
                image.sprite = sprite;
                image.color  = color;
            }
        }
Exemplo n.º 2
0
        private async void PlayAsync(string path, AudioParameters audioParameters)
        {
            if (!IsPlayAccessible())
            {
                return;
            }

            AudioPlayer audioPlayer = _sourcePool.Pop();

            var clip = await _audioClipCache.GetItem(path);

            audioPlayer.Play(clip, audioParameters);

            await ReleaseAfterPlayed(audioPlayer);
        }
Exemplo n.º 3
0
        private async Task PlayAsync(string path, AudioParameters audioParameters, CancellationToken token)
        {
            try
            {
                if (_audioPlayer.IsPlaying)
                {
                    await _audioPlayer.FadeVolume(0, token);
                }

                _audioClipCache.Release(_audioPlayer.ClipName);

                var clip = await _audioClipCache.GetItem(path);

                token.ThrowIfCancellationRequested();

                _audioPlayer.Play(clip, audioParameters);

                await _audioPlayer.FadeVolume(audioParameters.Volume, token);
            }
            catch (OperationCanceledException) { }
        }