using System.Collections; using System.Collections.Generic; using UnityEngine; public class FootStepSounder : MonoBehaviour { [SerializeField] private float StepInterval = 0.5f; [SerializeField] private float Volume = 0.25f; private float movedDist = 0; private Vector3 prevPos; // Update is called once per frame void Update() { movedDist += Vector3.Distance(transform.position, prevPos); if (movedDist % StepInterval < 0.1f) { AudioManager.PlaySound("Footstep_" + UnityEngine.Random.Range(0, 6), transform.position, true).volume = Volume; } prevPos = transform.position; } }