27 lines
969 B
C#
27 lines
969 B
C#
using UnityEngine;
|
||
|
||
namespace BaseGames.Core
|
||
{
|
||
/// <summary>
|
||
/// 音频服务接口。
|
||
/// 实现由 BaseGames.Audio 程序集提供;Core 层注册 NullAudioService 作为兜底。
|
||
/// </summary>
|
||
public interface IAudioService
|
||
{
|
||
/// <summary>播放背景音乐(循环)。key 对应 Addressables 地址或 Audio Mixer 键。</summary>
|
||
void PlayBGM(string key);
|
||
|
||
/// <summary>停止背景音乐。fadeTime > 0 则淡出。</summary>
|
||
void StopBGM(float fadeTime = 0f);
|
||
|
||
/// <summary>单次播放音效。</summary>
|
||
void PlaySFX(string key);
|
||
|
||
/// <summary>在世界坐标播放音效片段(用于 3D 音效)。</summary>
|
||
void PlaySFXAtPosition(AudioClip clip, Vector2 position, float volumeScale = 1f);
|
||
|
||
/// <summary>设置混音器音量(0–1)。group 取 AudioMixerKeys 常量。</summary>
|
||
void SetVolume(string group, float normalizedVolume);
|
||
}
|
||
}
|