footstep audio added

This commit is contained in:
2024-04-09 16:45:05 +01:00
parent faa835d790
commit 44f03fd82b
12 changed files with 219 additions and 25 deletions

View File

@@ -0,0 +1,20 @@
using FMODUnity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CollisionDetection : MonoBehaviour
{
[SerializeField]
private EventReference m_FootstepAudio;
// Start is called before the first frame update
public delegate void onContactSoundDelegate(GameObject obj, float force, EventReference soundObject);
public static onContactSoundDelegate m_PlaySoundOnContact;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name == "200x200")
{
m_PlaySoundOnContact?.Invoke(this.gameObject, collision.relativeVelocity.magnitude, m_FootstepAudio);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2c5b489d1464aad4a923b9eb7846f423
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: