using System; using UnityEngine; public class PlayerSounds : MonoBehaviour { private Player player; private float footstepTimer; private const float footstepTimerMax = .2f; private void Awake() => player = GetComponent(); private void Update() { footstepTimer -= Time.deltaTime; if (footstepTimer > 0f) return; footstepTimer = footstepTimerMax; if (!player.IsWalking()) return; const float volume = 1f; SoundManager.Instance.PlayFootstepsSound(player.transform.position, volume); } }