using UnityEngine;

public class CharacterAudio : MonoBehaviour
{
    [Header("Settings")]
    [SerializeField] private float bumpTimer = 2f;
    [SerializeField, Range(0, 1)] private float bumpChance = 0.3f;
    [SerializeField] private float stepDelay = 0.35f;

    [Header("Runtime")]
    [SerializeField, ReadOnly] private float bumpTimer_;

    public void Tick(float delta)
    {
        bumpTimer_ -= delta;
    }

    public void PlayBumpSound()
    {
        if (SoundManager.Instance != null)
        {
            if (bumpTimer_ <= 0)
            {
                float prob = UnityEngine.Random.Range(0f, 1f);
                if (prob <= bumpChance)
                {
                    bumpTimer_ = bumpTimer;
                    SoundManager.Instance.Play(SoundManager.SoundType.Bump);
                }
            }
        }
    }
}