chore : fix naming
This commit is contained in:
@@ -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<CharacterController>();
|
||||
|
||||
// On remplit le dictionnaire pour un accès ultra-rapide par le nom du tag
|
||||
|
||||
_surfaceCache = new Dictionary<string, AK.Wwise.Switch>();
|
||||
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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user