feat: 音效、音量、触感开关控制
This commit is contained in:
@@ -127,6 +127,27 @@ namespace OCES.Audio
|
||||
).SetEase(Ease.OutCubic);
|
||||
}
|
||||
|
||||
public void SetMusicVolume(float targetVolume)
|
||||
{
|
||||
this.m_mixer.SetFloat("MusicVolume", targetVolume);
|
||||
}
|
||||
|
||||
public void SetSFXVolume(float targetVolume)
|
||||
{
|
||||
this.m_mixer.SetFloat("SFXVolume", targetVolume);
|
||||
this.m_mixer.SetFloat("SFXAccentVolume", targetVolume);
|
||||
}
|
||||
|
||||
public void SetMusicState(bool enable)
|
||||
{
|
||||
SetMusicVolume(enable ? 0 : -80);
|
||||
}
|
||||
|
||||
public void SetSFXState(bool enable)
|
||||
{
|
||||
SetSFXVolume(enable ? 0 : -80);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新游戏状态,驱动音乐与环境音系统切换。
|
||||
/// 调用示例:AudioSystem.Instance.SetState(GameState.Game);
|
||||
|
||||
Reference in New Issue
Block a user