Merge branch 'SoundManager' into PlayerAnimator
This commit is contained in:
commit
5b09068b0c
2 files changed
+8
-7
No files matched your search
@@ -39,7 +39,7 @@ namespace Code.Audio
|
||||
SoundtrackListConfig soundtrackListConfig,
|
||||
SFXListConfig sfxListConfig,
|
||||
EnemiesSoundListConfig enemiesSoundListConfig,
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig//, CharacterSoundListConfig characterSoundListConfig
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig
|
||||
)
|
||||
{
|
||||
AudioMixer = audioMixerConfig.audioMixerAsset;
|
||||
@@ -51,7 +51,6 @@ namespace Code.Audio
|
||||
_SFX = sfxListConfig.SFX;
|
||||
_enemies = enemiesSoundListConfig.enemies;
|
||||
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
||||
// _character = characterSoundListConfig.character;
|
||||
|
||||
MusicDictionary.Add(MusicType.Menu, new ());
|
||||
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||
|
||||
@@ -99,19 +99,21 @@ namespace Code.Audio
|
||||
// await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||
// _ => !_musicAudioSources[musicType].isPlaying,
|
||||
// cancellationToken: _cancellationTokenSources[musicType].Token);
|
||||
await UniTask.WaitUntil(() => _musicAudioSources[musicType].isPlaying);
|
||||
Debug.Log($"Playing {musicType}");
|
||||
var isCanceled = await UniTask.WaitUntil(() => !_musicAudioSources[musicType].isPlaying,
|
||||
await UniTask.NextFrame();
|
||||
// Debug.Log($"Playing {musicType}");
|
||||
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||
_ => !_musicAudioSources[musicType].isPlaying,
|
||||
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
||||
Debug.Log($"Finished {musicType}");
|
||||
// Debug.Log($"Finished {musicType}");
|
||||
|
||||
if (isCanceled)
|
||||
{
|
||||
Debug.Log($"Cancelled {musicType}");
|
||||
// Debug.Log($"Cancelled {musicType}");
|
||||
_cancellationTokenSources[musicType].Dispose();
|
||||
_cancellationTokenSources[musicType] = new();
|
||||
|
||||
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
||||
_musicAudioSources[musicType] = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user