wip : footstep system for sand in house

This commit is contained in:
Hugo Le Bolloc'h
2026-06-07 19:08:48 +02:00
parent 8197cac85d
commit 6d049858d1
76 changed files with 1963 additions and 441 deletions
@@ -56,8 +56,17 @@ public class Audio_FootstepsController : MonoBehaviour
RaycastHit hit;
if (Physics.Raycast(transform.position + Vector3.up * 0.1f, Vector3.down, out hit, _rayDistance, _groundLayer))
{
if (hit.collider.TryGetComponent<Audio_SoundSurface>(out var surface))
Audio_SoundSurface surface = hit.collider.GetComponent<Audio_SoundSurface>();
// If not on the collider itself, check parent objects
if (surface == null)
surface = hit.collider.GetComponentInParent<Audio_SoundSurface>();
// If still not found, check children of the hit object
if (surface == null)
surface = hit.collider.GetComponentInChildren<Audio_SoundSurface>();
if (surface != null)
{
surface.wwiseSwitch.SetValue(gameObject);
}
@@ -66,8 +75,6 @@ public class Audio_FootstepsController : MonoBehaviour
defaultSwitch.SetValue(gameObject);
Debug.Log($"[Footsteps] No GroundSurface component on '{hit.collider.name}'. Utilisation du switch par défaut.");
}
footstepEvent.Post(gameObject);
}
@@ -0,0 +1,42 @@
using UnityEngine;
using AK.Wwise;
public class Audio_TimerRTPCController : MonoBehaviour
{
[Header("Timer Settings")]
[SerializeField] private float _duration = 10f;
[SerializeField] private float _updateInterval = 0.5f;
[Header("Wwise")]
[SerializeField] private string _rtpcName = "MyRTPC";
private float _elapsed = 0f;
private float _timeSinceLastUpdate = 0f;
private bool _isRunning = true;
private void Start()
{
AkUnitySoundEngine.SetRTPCValue(_rtpcName, 0f);
}
private void Update()
{
if (!_isRunning) return;
_elapsed += Time.deltaTime;
_timeSinceLastUpdate += Time.deltaTime;
if (_elapsed >= _duration)
{
AkUnitySoundEngine.SetRTPCValue(_rtpcName, _duration);
_isRunning = false;
return;
}
if (_timeSinceLastUpdate >= _updateInterval)
{
_timeSinceLastUpdate = 0f;
AkUnitySoundEngine.SetRTPCValue(_rtpcName, _elapsed);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9530f0bda4b798e4aa2f62840f7baae1