From 17cd6987b7aed13ce618395842467160fac99963 Mon Sep 17 00:00:00 2001 From: Hugo Le Bolloc'h Date: Fri, 27 Mar 2026 16:32:28 +0100 Subject: [PATCH] chore : fix naming --- .../Core/Audio/Audio_FootstepsController.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Assets/Unheimlich_POC/Scripts/Core/Audio/Audio_FootstepsController.cs b/Assets/Unheimlich_POC/Scripts/Core/Audio/Audio_FootstepsController.cs index 905e3c21..91260844 100644 --- a/Assets/Unheimlich_POC/Scripts/Core/Audio/Audio_FootstepsController.cs +++ b/Assets/Unheimlich_POC/Scripts/Core/Audio/Audio_FootstepsController.cs @@ -20,10 +20,10 @@ public class Audio_FootstepsController : MonoBehaviour public AK.Wwise.Switch defaultSwitch; [Header("Movement Settings")] - [SerializeField] private float stepInterval = 0.5f; - [SerializeField] private float minVelocity = 0.1f; - [SerializeField] private float rayDistance = 1.2f; - [SerializeField] private LayerMask groundLayer; + [SerializeField] private float _stepInterval = 0.5f; + [SerializeField] private float _minVelocity = 0.3f; + [SerializeField] private float _rayDistance = 0.2f; + [SerializeField] private LayerMask _groundLayer; private CharacterController _controller; private float _timer; @@ -33,13 +33,13 @@ public class Audio_FootstepsController : MonoBehaviour { _controller = GetComponent(); - // On remplit le dictionnaire pour un accès ultra-rapide par le nom du tag + _surfaceCache = new Dictionary(); foreach (var mapping in surfaces) { if (!string.IsNullOrEmpty(mapping.tag)) { - // On stocke en minuscule pour éviter les erreurs de casse + _surfaceCache[mapping.tag.ToLower()] = mapping.wwiseSwitch; } } @@ -47,10 +47,10 @@ public class Audio_FootstepsController : MonoBehaviour void Update() { - if (_controller.isGrounded && _controller.velocity.magnitude > minVelocity) + if (_controller.isGrounded && _controller.velocity.magnitude > _minVelocity) { _timer += Time.deltaTime; - if (_timer >= stepInterval) + if (_timer >= _stepInterval) { PlayFootstep(); _timer = 0f; @@ -58,22 +58,22 @@ public class Audio_FootstepsController : MonoBehaviour } else { - _timer = stepInterval; + _timer = _stepInterval; } } private void PlayFootstep() { RaycastHit hit; - if (Physics.Raycast(transform.position + Vector3.up * 0.1f, Vector3.down, out hit, rayDistance, groundLayer)) + if (Physics.Raycast(transform.position + Vector3.up * 0.1f, Vector3.down, out hit, _rayDistance, _groundLayer)) { string currentTag = hit.collider.tag.ToLower(); - // On cherche le switch dans le dictionnaire + if (_surfaceCache.TryGetValue(currentTag, out AK.Wwise.Switch targetSwitch)) { targetSwitch.SetValue(gameObject); - // Debug.Log($"[Footsteps] Switch Wwise réglé sur : {currentTag}"); + // Debug.Log($"[Footsteps] Switch Wwise set on : {currentTag}"); } else {