Files
Project-M/Assets/_Project/Scripts/Client/Settings/GameVolume.cs
T
kronic f31ffe910b Frontend menu + settings + saves foundation
Netcode frontend pattern: UITK main menu / pause / settings (MenuUi + controllers), on-demand world lifecycle (WorldLauncher/SessionRunner), GameBootstrap menu branch; Graphics/Audio settings (SettingsService/GameVolume); single-slot save foundation (SaveData/SaveService, born-correct load at director spawn, autosave on Siege->Calm + quit); RuntimePanelSettings + theme; BuildTool menu; 10 EditMode tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 15:05:36 -07:00

34 lines
1.5 KiB
C#

using UnityEngine;
namespace ProjectM.Client
{
/// <summary>
/// Client-only audio volume BUSES, read by the procedural-audio presentation systems
/// (<see cref="AmbientAudioSystem"/> = Music bus; <see cref="CombatFeedbackSystem"/> +
/// <see cref="WorldFeedbackSystem"/> = Sfx bus). MASTER is applied separately as
/// <c>AudioListener.volume</c> (a global listener gain) by <see cref="SettingsService"/>, so the per-call
/// multipliers here are the per-bus trims ONLY — never multiply by master again or it double-attenuates.
/// <para>
/// A plain static (not an <c>IComponentData</c>) so the Burst-free managed presentation systems read it with
/// zero ECS plumbing. NOT named <c>AudioSettings</c> — that collides with <c>UnityEngine.AudioSettings</c>.
/// Reset on play-enter (<see cref="RuntimeInitializeLoadType.SubsystemRegistration"/>) so a fast-enter-playmode
/// domain reload never carries a stale value into a fresh session.
/// </para>
/// </summary>
public static class GameVolume
{
/// <summary>Music/ambience bus trim (0..1). Applied by AmbientAudioSystem.</summary>
public static float Music = 1f;
/// <summary>SFX bus trim (0..1). Applied by Combat/World feedback systems.</summary>
public static float Sfx = 1f;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics()
{
Music = 1f;
Sfx = 1f;
}
}
}