Развитие гоночек

This commit is contained in:
ThomasCharester committed 2026-02-06 10:30:50 +03:00
1 parent ec60c47652
commit b54083521f
532 files changed
+16091 -28231

No files matched your search

@@ -33,7 +33,7 @@ namespace Code.Infrastructure.Audio
private string _configsLabel;
private AsyncOperationHandle<IList<AudioSourceSettingsConfig>> _handles;
private AssetReference _sourcePrefabConfigReference;
private AsyncOperationHandle<AudioServiceSettingsConfig> _prefabConfigHandle;
private AsyncOperationHandle<AudioSourcePrefabConfig> _prefabConfigHandle;
private AsyncOperationHandle<GameObject> _prefabHandle;
private EventBus.EventBus _eventBus;
@@ -42,14 +42,14 @@ namespace Code.Infrastructure.Audio
_eventBus = eventBus;
_configsLabel = configLocator.TryGetManyConfigAssetReferences<AudioSourceSettingsConfig>();
_sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference<AudioServiceSettingsConfig>();
_sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference<AudioSourcePrefabConfig>();
LoadConfigs().Forget();
}
private async UniTaskVoid LoadConfigs()
{
_prefabConfigHandle = Addressables.LoadAssetAsync<AudioServiceSettingsConfig>(_sourcePrefabConfigReference);
_prefabConfigHandle = Addressables.LoadAssetAsync<AudioSourcePrefabConfig>(_sourcePrefabConfigReference);
_handles = Addressables.LoadAssetsAsync<AudioSourceSettingsConfig>(_configsLabel);
await UniTask.WhenAll(
@@ -102,58 +102,7 @@ namespace Code.Infrastructure.Audio
{
Object.Destroy(source.gameObject);
}
//
// public async UniTaskVoid PlayOneShot(AudioClip clip, Vector3 position, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
// {
// AudioSource source = _pool.Get();
// source.PlayOneShot(clip);
// source.spatialBlend = _settings[audioSourceType].spatialBlend;
// source.transform.position = position;
// source.outputAudioMixerGroup = audioMixerGroup;
//
// await UniTask.WaitUntilValueChanged(source, x => x.isPlaying);
// onComplete?.Invoke();
// _pool.Release(source);
// }
// public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
// {
// AudioSource source = _pool.Get();
// source.PlayOneShot(clip);
// source.spatialBlend = _settings[audioSourceType].spatialBlend;
// source.outputAudioMixerGroup = audioMixerGroup;
//
// await UniTask.WaitUntilValueChanged(source, x => x.isPlaying);
// onComplete?.Invoke();
// _pool.Release(source);
// }
// public async UniTaskVoid PlayOneShot(AudioSource audioSource, AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
// {
// audioSource.PlayOneShot(clip);
// audioSource.spatialBlend = _settings[audioSourceType].spatialBlend;
// audioSource.outputAudioMixerGroup = audioMixerGroup;
//
// // TODO Потом сделать. Можно с cancellation, но сейчас лень. Ну правда
// await UniTask.WaitUntilValueChanged(audioSource, x => x.isPlaying);
//
// if (!audioSource) return;
//
// _pool.Release(audioSource);
// onComplete?.Invoke();
// }
// public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, CancellationTokenSource cancellationToken, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
// {
// AudioSource source = _pool.Get();
// source.PlayOneShot(clip);
// source.spatialBlend = _settings[audioSourceType].spatialBlend;
// source.outputAudioMixerGroup = audioMixerGroup;
//
// var (isCanceled, _) = await UniTask.WaitUntilValueChanged(source, x => x.isPlaying, cancellationToken: cancellationToken.Token).SuppressCancellationThrow();
//
// _pool.Release(source);
//
// if(!isCanceled) onComplete?.Invoke();
// else cancellationToken.Dispose();
// }
public AudioSource GetSource(AudioSourceType sourceType)
{
var source = _pool.Get();