footstep audio added
This commit is contained in:
20
Assets/8_Scripts/2_General/CollisionDetection.cs
Normal file
20
Assets/8_Scripts/2_General/CollisionDetection.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/2_General/CollisionDetection.cs.meta
generated
Normal file
11
Assets/8_Scripts/2_General/CollisionDetection.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c5b489d1464aad4a923b9eb7846f423
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user