Files
zeling_v2/Assets/_Game/Scripts/Audio/FootstepAudioConfigSO.cs

31 lines
982 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Assets/Scripts/Audio/FootstepAudioConfigSO.cs
// 脚步声音效配置Architecture 21_LiquidPuzzleModule §3.3
using System;
using UnityEngine;
namespace BaseGames.Audio
{
[CreateAssetMenu(menuName = "BaseGames/BaseGames/Audio/FootstepAudioConfig")]
public class FootstepAudioConfigSO : ScriptableObject
{
[Serializable]
public struct MaterialEntry
{
public FootstepMaterial material;
public AudioClip[] clips; // 随机选一个,防止重复感
[Range(0f, 1f)] public float volume;
[Range(0.8f, 1.2f)] public float pitchVariance; // 每次随机 pitch 偏移范围
}
public MaterialEntry[] entries;
public MaterialEntry? GetEntry(FootstepMaterial mat)
{
if (entries == null) return null;
foreach (var e in entries)
if (e.material == mat) return e;
return null;
}
}
}