First commit for private source control. Older commits available on Github.
This commit is contained in:
129
Assets/Scripts/Framework/Managers/Audio/Data/AudioFileSO.cs
Normal file
129
Assets/Scripts/Framework/Managers/Audio/Data/AudioFileSO.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Framework.Managers.Audio.Data
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Briar Queen/Audio/New Audio File", fileName = "New Audio File")]
|
||||
public class AudioFileSo : ScriptableObject
|
||||
{
|
||||
[Header("Audio Type")]
|
||||
[SerializeField]
|
||||
private TrackType _type;
|
||||
|
||||
[Header("Audio ID")]
|
||||
[SerializeField]
|
||||
[ShowIf(nameof(IsMusic))]
|
||||
private MusicKey _musicKey;
|
||||
|
||||
[SerializeField]
|
||||
[ShowIf(nameof(IsSfx))]
|
||||
private SFXKey _sfxKey;
|
||||
|
||||
[SerializeField]
|
||||
[ShowIf(nameof(IsUiFx))]
|
||||
private UIFXKey _uiFxKey;
|
||||
|
||||
[SerializeField]
|
||||
[ShowIf(nameof(IsAmbience))]
|
||||
private AmbienceKey _ambienceKey;
|
||||
|
||||
[SerializeField]
|
||||
[ShowIf(nameof(IsVoice))]
|
||||
private VoiceKey _voiceKey;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("A globally unique identifier used for linking with subtitles or dialogue events.")]
|
||||
private SubtitleKey _matchingSubtitleID;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("A readable display name (optional, for debugging or editor UI).")]
|
||||
private string _displayName;
|
||||
|
||||
[Header("Audio Settings")]
|
||||
[SerializeField]
|
||||
private AudioClip _clip;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0f, 1f)]
|
||||
private float _volume = 1f;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0.5f, 2f)]
|
||||
private float _pitch = 1f;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0, 256)]
|
||||
private int _priority = 128;
|
||||
|
||||
[SerializeField]
|
||||
private bool _loopable;
|
||||
|
||||
[Header("Mixing & Behavior")]
|
||||
[SerializeField]
|
||||
[Tooltip("If true, music volume will duck during playback.")]
|
||||
private bool _duckMusic;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Seconds to fade music back in after ducking.")]
|
||||
[Min(0.1f)]
|
||||
private float _fadeTime = 0.5f;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Optional narrative event name (for triggers, debugging, or cutscenes).")]
|
||||
private string _narrativeEvent;
|
||||
|
||||
public TrackType Type => _type;
|
||||
|
||||
public bool IsMusic => _type == TrackType.Music;
|
||||
public bool IsSfx => _type == TrackType.Sfx;
|
||||
public bool IsUiFx => _type == TrackType.UIFX;
|
||||
public bool IsAmbience => _type == TrackType.Ambience;
|
||||
public bool IsVoice => _type == TrackType.Voice;
|
||||
|
||||
public MusicKey MusicKey => _musicKey;
|
||||
public SFXKey SfxKey => _sfxKey;
|
||||
public UIFXKey UiFxKey => _uiFxKey;
|
||||
public AmbienceKey AmbienceKey => _ambienceKey;
|
||||
public VoiceKey VoiceKey => _voiceKey;
|
||||
|
||||
public SubtitleKey MatchingSubtitleID => _matchingSubtitleID;
|
||||
public string DisplayName => _displayName;
|
||||
|
||||
public AudioClip Clip => _clip;
|
||||
public float Volume => _volume;
|
||||
public float Pitch => _pitch;
|
||||
public int Priority => _priority;
|
||||
public bool Loopable => _loopable;
|
||||
|
||||
public bool DuckMusic => _duckMusic;
|
||||
public float FadeTime => _fadeTime;
|
||||
public string NarrativeEvent => _narrativeEvent;
|
||||
|
||||
public string UniqueID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _type switch
|
||||
{
|
||||
TrackType.Music when _musicKey != MusicKey.None =>
|
||||
AudioNameIdentifiers.Get(_musicKey),
|
||||
|
||||
TrackType.Sfx when _sfxKey != SFXKey.None =>
|
||||
AudioNameIdentifiers.Get(_sfxKey),
|
||||
|
||||
TrackType.UIFX when _uiFxKey != UIFXKey.None =>
|
||||
AudioNameIdentifiers.Get(_uiFxKey),
|
||||
|
||||
TrackType.Ambience when _ambienceKey != AmbienceKey.None =>
|
||||
AudioNameIdentifiers.Get(_ambienceKey),
|
||||
|
||||
TrackType.Voice when _voiceKey != VoiceKey.None =>
|
||||
AudioNameIdentifiers.Get(_voiceKey),
|
||||
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user