fix use skill the second can't hear sfx
This commit is contained in:
@@ -95,13 +95,14 @@ namespace BrewMonster.Scripts
|
||||
/// </summary>
|
||||
public async UniTaskVoid PlaySkillSfxAtPointAsync(string address, Vector3 worldPos)
|
||||
{
|
||||
BMLogger.LogError ($"HoangDev PlaySkillSfxAtPointAsync: address={address}, worldPos={worldPos}");
|
||||
if (string.IsNullOrEmpty(address)) return;
|
||||
var mgr = AddressableManager.Instance;
|
||||
if (mgr == null) return;
|
||||
|
||||
if (mgr.TryGetCachedAudioClip(address, out var clip) && clip != null)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(clip, worldPos, SkillSfxVolume);
|
||||
AudioSource.PlayClipAtPoint(clip, Vector3.zero, SkillSfxVolume);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,7 +181,6 @@ namespace BrewMonster.Scripts
|
||||
/// </summary>
|
||||
public async UniTaskVoid PlayMoveSoundAsync(int id)
|
||||
{
|
||||
BMLogger.LogError($"HoangDev PlayMoveSoundAsync: id={id}, source={_moveSoundSource}");
|
||||
if (_moveSoundSource == null) return;
|
||||
|
||||
_moveSoundSource.Stop();
|
||||
@@ -188,12 +188,10 @@ namespace BrewMonster.Scripts
|
||||
if (id <= 0) return;
|
||||
|
||||
var path = GetSFXPath(id);
|
||||
BMLogger.LogError($"HoangDev PlayMoveSoundAsync: resolved path='{path}'");
|
||||
if (string.IsNullOrEmpty(path)) return;
|
||||
|
||||
if (AddressableManager.Instance.TryGetCachedAudioClip(path, out var clip) && clip != null)
|
||||
{
|
||||
BMLogger.LogError($"HoangDev PlayMoveSoundAsync: found cached clip='{clip.name}'");
|
||||
_moveSoundSource.clip = clip;
|
||||
_moveSoundSource.loop = true;
|
||||
_moveSoundSource.Play();
|
||||
@@ -204,7 +202,6 @@ namespace BrewMonster.Scripts
|
||||
var loaded = await AddressableManager.Instance.LoadAudioClipAsync(path);
|
||||
if (loaded != null)
|
||||
{
|
||||
BMLogger.LogError($"HoangDev PlayMoveSoundAsync: loaded clip='{loaded.name}'");
|
||||
_moveSoundSource.clip = loaded;
|
||||
_moveSoundSource.loop = true;
|
||||
_moveSoundSource.Play();
|
||||
|
||||
@@ -4212,7 +4212,6 @@ namespace BrewMonster
|
||||
/// </summary>
|
||||
private void PlayMoveSound(int id)
|
||||
{
|
||||
BMLogger.LogError($"HoangDev PlayMoveSound called with id: {id}"); // Debug log to trace sound ID changes
|
||||
if (id == _curMoveSndId) return;
|
||||
_curMoveSndId = id;
|
||||
SFXManager.Instance?.PlayMoveSoundAsync(id).Forget();
|
||||
|
||||
Reference in New Issue
Block a user