Files
zeling_v2/Assets/Scripts/Core/NullAudioService.cs
2026-05-08 11:04:00 +08:00

25 lines
988 B
C#

using UnityEngine;
namespace BaseGames.Core
{
/// <summary>
/// IAudioService 的空实现,作为兜底防止 NullReferenceException。
/// 在 GameServiceRegistrar 中作为默认音频服务注册;
/// Phase 2 Audio 模块实现完整后替换。
/// </summary>
public sealed class NullAudioService : IAudioService
{
public void PlayBGM(string key)
=> Debug.LogWarning($"[NullAudioService] PlayBGM({key}) — 音频系统未初始化。");
public void StopBGM(float fadeTime = 0f)
=> Debug.LogWarning("[NullAudioService] StopBGM — 音频系统未初始化。");
public void PlaySFX(string key)
=> Debug.LogWarning($"[NullAudioService] PlaySFX({key}) — 音频系统未初始化。");
public void SetVolume(string group, float normalizedVolume)
=> Debug.LogWarning($"[NullAudioService] SetVolume({group}, {normalizedVolume}) — 音频系统未初始化。");
}
}