wip : footstep system for sand in house
This commit is contained in:
@@ -165,6 +165,7 @@ GameObject:
|
||||
- component: {fileID: 300277221}
|
||||
- component: {fileID: 300277220}
|
||||
- component: {fileID: 300277219}
|
||||
- component: {fileID: 300277223}
|
||||
m_Layer: 0
|
||||
m_Name: Ground
|
||||
m_TagString: Untagged
|
||||
@@ -266,6 +267,24 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1920554116}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &300277223
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 300277218}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3ec78f9fa08450a4fb1c6ef69da4e22c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Audio_SoundSurface
|
||||
wwiseSwitch:
|
||||
idInternal: 0
|
||||
valueGuidInternal:
|
||||
groupIdInternal: 0
|
||||
groupGuidInternal:
|
||||
WwiseObjectReference: {fileID: 11400000, guid: 8279689ba5a85c4499ad4e916d20151a, type: 2}
|
||||
--- !u!1 &401462667
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -309,6 +328,8 @@ GameObject:
|
||||
- component: {fileID: 412733325}
|
||||
- component: {fileID: 412733327}
|
||||
- component: {fileID: 412733326}
|
||||
- component: {fileID: 412733328}
|
||||
- component: {fileID: 412733329}
|
||||
m_Layer: 0
|
||||
m_Name: sand LOD
|
||||
m_TagString: Untagged
|
||||
@@ -324,7 +345,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 412733324}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
@@ -388,6 +409,46 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 412733324}
|
||||
m_Mesh: {fileID: 8802771628929948559, guid: 311617a3ba39d7643abf5c46141d0c80, type: 3}
|
||||
--- !u!114 &412733328
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 412733324}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3ec78f9fa08450a4fb1c6ef69da4e22c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Audio_SoundSurface
|
||||
wwiseSwitch:
|
||||
idInternal: 0
|
||||
valueGuidInternal:
|
||||
groupIdInternal: 0
|
||||
groupGuidInternal:
|
||||
WwiseObjectReference: {fileID: 11400000, guid: cea23ef8af49aa54f9c3833465570bb2, type: 2}
|
||||
--- !u!64 &412733329
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 412733324}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 0
|
||||
serializedVersion: 5
|
||||
m_Convex: 1
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 8802771628929948559, guid: 311617a3ba39d7643abf5c46141d0c80, type: 3}
|
||||
--- !u!1 &638365844
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1471,6 +1532,7 @@ GameObject:
|
||||
- component: {fileID: 1904167642}
|
||||
- component: {fileID: 1904167641}
|
||||
- component: {fileID: 1904167644}
|
||||
- component: {fileID: 1904167645}
|
||||
m_Layer: 0
|
||||
m_Name: Trigger
|
||||
m_TagString: Untagged
|
||||
@@ -1559,6 +1621,21 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::SandController
|
||||
SandRenderer: {fileID: 412733326}
|
||||
Duration: 20
|
||||
--- !u!114 &1904167645
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1904167640}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9530f0bda4b798e4aa2f62840f7baae1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Audio_TimerRTPCController
|
||||
_duration: 15.3
|
||||
_updateInterval: 0.1
|
||||
_rtpcName: footstepSand_Level_Rtpc
|
||||
--- !u!1 &1920554115
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user