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,
|
SoundtrackListConfig soundtrackListConfig,
|
||||||
SFXListConfig sfxListConfig,
|
SFXListConfig sfxListConfig,
|
||||||
EnemiesSoundListConfig enemiesSoundListConfig,
|
EnemiesSoundListConfig enemiesSoundListConfig,
|
||||||
DispatcherSoundListConfig dispatcherSoundListConfig//, CharacterSoundListConfig characterSoundListConfig
|
DispatcherSoundListConfig dispatcherSoundListConfig
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
AudioMixer = audioMixerConfig.audioMixerAsset;
|
AudioMixer = audioMixerConfig.audioMixerAsset;
|
||||||
@@ -51,7 +51,6 @@ namespace Code.Audio
|
|||||||
_SFX = sfxListConfig.SFX;
|
_SFX = sfxListConfig.SFX;
|
||||||
_enemies = enemiesSoundListConfig.enemies;
|
_enemies = enemiesSoundListConfig.enemies;
|
||||||
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
||||||
// _character = characterSoundListConfig.character;
|
|
||||||
|
|
||||||
MusicDictionary.Add(MusicType.Menu, new ());
|
MusicDictionary.Add(MusicType.Menu, new ());
|
||||||
MusicDictionary.Add(MusicType.Peaceful, new ());
|
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||||
|
|||||||
@@ -99,19 +99,21 @@ namespace Code.Audio
|
|||||||
// await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
// await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||||
// _ => !_musicAudioSources[musicType].isPlaying,
|
// _ => !_musicAudioSources[musicType].isPlaying,
|
||||||
// cancellationToken: _cancellationTokenSources[musicType].Token);
|
// cancellationToken: _cancellationTokenSources[musicType].Token);
|
||||||
await UniTask.WaitUntil(() => _musicAudioSources[musicType].isPlaying);
|
await UniTask.NextFrame();
|
||||||
Debug.Log($"Playing {musicType}");
|
// Debug.Log($"Playing {musicType}");
|
||||||
var isCanceled = await UniTask.WaitUntil(() => !_musicAudioSources[musicType].isPlaying,
|
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||||
|
_ => !_musicAudioSources[musicType].isPlaying,
|
||||||
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
||||||
Debug.Log($"Finished {musicType}");
|
// Debug.Log($"Finished {musicType}");
|
||||||
|
|
||||||
if (isCanceled)
|
if (isCanceled)
|
||||||
{
|
{
|
||||||
Debug.Log($"Cancelled {musicType}");
|
// Debug.Log($"Cancelled {musicType}");
|
||||||
_cancellationTokenSources[musicType].Dispose();
|
_cancellationTokenSources[musicType].Dispose();
|
||||||
_cancellationTokenSources[musicType] = new();
|
_cancellationTokenSources[musicType] = new();
|
||||||
|
|
||||||
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
||||||
|
_musicAudioSources[musicType] = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user