Merge branch 'main' of http://212.24.110.183:3000/IPSEITY/Unheimlich_POC
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,87 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using AK.Wwise;
|
||||
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
public class Audio_FootstepsController : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct SurfaceMapping
|
||||
{
|
||||
public string tag;
|
||||
public AK.Wwise.Switch wwiseSwitch;
|
||||
}
|
||||
|
||||
[Header("Wwise Assets")]
|
||||
public AK.Wwise.Event footstepEvent;
|
||||
|
||||
[Header("Surface Configuration")]
|
||||
public List<SurfaceMapping> surfaces = new List<SurfaceMapping>();
|
||||
public AK.Wwise.Switch defaultSwitch;
|
||||
|
||||
[Header("Movement Settings")]
|
||||
[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;
|
||||
private Dictionary<string, AK.Wwise.Switch> _surfaceCache;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_controller = GetComponent<CharacterController>();
|
||||
|
||||
|
||||
_surfaceCache = new Dictionary<string, AK.Wwise.Switch>();
|
||||
foreach (var mapping in surfaces)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(mapping.tag))
|
||||
{
|
||||
|
||||
_surfaceCache[mapping.tag.ToLower()] = mapping.wwiseSwitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_controller.isGrounded && _controller.velocity.magnitude > _minVelocity)
|
||||
{
|
||||
_timer += Time.deltaTime;
|
||||
if (_timer >= _stepInterval)
|
||||
{
|
||||
PlayFootstep();
|
||||
_timer = 0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_timer = _stepInterval;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayFootstep()
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(transform.position + Vector3.up * 0.1f, Vector3.down, out hit, _rayDistance, _groundLayer))
|
||||
{
|
||||
string currentTag = hit.collider.tag.ToLower();
|
||||
|
||||
|
||||
if (_surfaceCache.TryGetValue(currentTag, out AK.Wwise.Switch targetSwitch))
|
||||
{
|
||||
targetSwitch.SetValue(gameObject);
|
||||
// Debug.Log($"[Footsteps] Switch Wwise set on : {currentTag}");
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultSwitch.SetValue(gameObject);
|
||||
Debug.LogWarning($"[Footsteps] Tag '{currentTag}' inconnu. Utilisation du switch par défaut.");
|
||||
}
|
||||
|
||||
footstepEvent.Post(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a11b07babb12d446a356745e7a37303
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 585ef86653ff8b34996821f778cfa782
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7b54f077b8751ef4fab18faa68deb555, type: 3}
|
||||
m_Name: 022E15A9-DB2C-45F3-8D60-42B5972AD986
|
||||
m_EditorClassIdentifier: AK.Wwise.Unity.API.WwiseTypes::WwiseSwitchReference
|
||||
objectName: carpet
|
||||
id: 2412606308
|
||||
guid: 022E15A9-DB2C-45F3-8D60-42B5972AD986
|
||||
WwiseSwitchGroupReference: {fileID: 11400000, guid: 7894acdae10032b4fa5eb169b135dab7, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba7dd3dc6dddc744b665136cf09f95f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7b54f077b8751ef4fab18faa68deb555, type: 3}
|
||||
m_Name: 1B0178C8-ACAF-41A3-83AA-085C6045F07C
|
||||
m_EditorClassIdentifier: AK.Wwise.Unity.API.WwiseTypes::WwiseSwitchReference
|
||||
objectName: wood
|
||||
id: 2058049674
|
||||
guid: 1B0178C8-ACAF-41A3-83AA-085C6045F07C
|
||||
WwiseSwitchGroupReference: {fileID: 11400000, guid: 7894acdae10032b4fa5eb169b135dab7, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90b25d313fd10fe4bb34ce68d987f60e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7b54f077b8751ef4fab18faa68deb555, type: 3}
|
||||
m_Name: C2B3EAC0-49E1-4C4B-A47E-8667C7765937
|
||||
m_EditorClassIdentifier: AK.Wwise.Unity.API.WwiseTypes::WwiseSwitchReference
|
||||
objectName: stone
|
||||
id: 1216965916
|
||||
guid: C2B3EAC0-49E1-4C4B-A47E-8667C7765937
|
||||
WwiseSwitchGroupReference: {fileID: 11400000, guid: 7894acdae10032b4fa5eb169b135dab7, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cea23ef8af49aa54f9c3833465570bb2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10d78c2f2a4c09a409f48d467acfee5f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cb51cd373049a214d85ff57cc88668be, type: 3}
|
||||
m_Name: 8CACC1F3-9150-4639-BB38-0F00BB2E289F
|
||||
m_EditorClassIdentifier: AK.Wwise.Unity.API.WwiseTypes::WwiseSwitchGroupReference
|
||||
objectName: footstepsType
|
||||
id: 520915638
|
||||
guid: 8CACC1F3-9150-4639-BB38-0F00BB2E289F
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7894acdae10032b4fa5eb169b135dab7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user