2026-04-29 게임 로딩 개선
This commit is contained in:
@@ -6,8 +6,12 @@ public class SoundManager : MonoBehaviour
|
||||
public static SoundManager Instance { get; private set; }
|
||||
|
||||
[SerializeField] private AudioSource _bgmSource;
|
||||
[SerializeField] private AudioSource _sfxSource;
|
||||
[SerializeField] private AudioMixer _mixer;
|
||||
|
||||
[Header("SFX")]
|
||||
[SerializeField] private AudioClip SFX_UIHover;
|
||||
|
||||
private const string BGM_VOLUME_PARAM = "BGMVolume";
|
||||
private const string SFX_VOLUME_PARAM = "SFXVolume";
|
||||
|
||||
@@ -26,6 +30,12 @@ private void OnDestroy()
|
||||
if (Instance == this) Instance = null;
|
||||
}
|
||||
|
||||
public void PlaySFX(AudioClip clip)
|
||||
{
|
||||
if(_sfxSource == null || clip == null) return;
|
||||
_sfxSource.PlayOneShot(clip);
|
||||
}
|
||||
|
||||
public void PlayBGM(AudioClip clip)
|
||||
{
|
||||
if (_bgmSource == null || clip == null) return;
|
||||
@@ -75,4 +85,9 @@ private void SetMixerVolume(string parameter, float linear)
|
||||
float db = linear > 0.0001f ? Mathf.Log10(linear) * 20f : -80f;
|
||||
_mixer.SetFloat(parameter, db);
|
||||
}
|
||||
|
||||
public void SFXPlay_UIHover()
|
||||
{
|
||||
PlaySFX(SFX_UIHover);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user