From 11a4bc510e0b7c01fd166ea363ba3a251695654f Mon Sep 17 00:00:00 2001 From: cyndrdev Date: Mon, 17 May 2021 17:29:18 +0100 Subject: [PATCH] added plate sounds --- .../Prefabs/PressurePlateDoor/Plate.prefab | 1 + game/Assets/Scripts/Audio/SFXTrigger.cs | 25 ++++ game/Assets/Scripts/Audio/SFXTrigger.cs.meta | 11 ++ .../Scripts/PressurePlate/PressurePlate.cs | 6 +- .../Build/Desktop/Master.strings.bank | 4 +- game/FMOD Project/Build/Desktop/SFX.bank | 4 +- ...{a072221a-e880-42a8-9a1f-6018d84388f5}.xml | 20 +++ ...{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}.xml | 128 ++++++++++++++++++ 8 files changed, 194 insertions(+), 5 deletions(-) create mode 100644 game/Assets/Scripts/Audio/SFXTrigger.cs create mode 100644 game/Assets/Scripts/Audio/SFXTrigger.cs.meta create mode 100644 game/FMOD Project/Metadata/AudioFile/{a072221a-e880-42a8-9a1f-6018d84388f5}.xml create mode 100644 game/FMOD Project/Metadata/Event/{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}.xml diff --git a/game/Assets/Prefabs/PressurePlateDoor/Plate.prefab b/game/Assets/Prefabs/PressurePlateDoor/Plate.prefab index 8782f74..50b328e 100644 --- a/game/Assets/Prefabs/PressurePlateDoor/Plate.prefab +++ b/game/Assets/Prefabs/PressurePlateDoor/Plate.prefab @@ -226,6 +226,7 @@ MonoBehaviour: _resetDelay: -1 _objectTimeScale: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2} _graphics: {fileID: 172610034636199716} + _sfx: event:/Environment/Interactables/Button _onPress: m_PersistentCalls: m_Calls: [] diff --git a/game/Assets/Scripts/Audio/SFXTrigger.cs b/game/Assets/Scripts/Audio/SFXTrigger.cs new file mode 100644 index 0000000..2a4a06b --- /dev/null +++ b/game/Assets/Scripts/Audio/SFXTrigger.cs @@ -0,0 +1,25 @@ +using FMOD.Studio; +using FMODUnity; +using UnityEngine; +using STOP_MODE = FMOD.Studio.STOP_MODE; + +public class SFXTrigger : MonoBehaviour +{ + [SerializeField] + [EventRef] + private string _sfx; + + private EventInstance _sfxInstance; + + void Awake() + { + _sfxInstance = RuntimeManager.CreateInstance( _sfx ); + RuntimeManager.AttachInstanceToGameObject( _sfxInstance, transform, (Rigidbody)null ); + } + + public void Trigger() + { + _sfxInstance.stop(STOP_MODE.IMMEDIATE); + _sfxInstance.start(); + } +} diff --git a/game/Assets/Scripts/Audio/SFXTrigger.cs.meta b/game/Assets/Scripts/Audio/SFXTrigger.cs.meta new file mode 100644 index 0000000..1ad1b49 --- /dev/null +++ b/game/Assets/Scripts/Audio/SFXTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebda6b115fef23f4e8c4022e31ad6a79 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/PressurePlate/PressurePlate.cs b/game/Assets/Scripts/PressurePlate/PressurePlate.cs index 904b3d2..d413759 100644 --- a/game/Assets/Scripts/PressurePlate/PressurePlate.cs +++ b/game/Assets/Scripts/PressurePlate/PressurePlate.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using FMODUnity; using Ktyl.Util; using UnityEngine; using UnityEngine.Events; @@ -11,6 +12,9 @@ public class PressurePlate : MonoBehaviour [SerializeField] private float _resetDelay = -1f; [SerializeField] private SerialFloat _objectTimeScale; [SerializeField] private GameObject _graphics; + [SerializeField] + [EventRef] + private string _sfx; public UnityEvent OnPress => _onPress; [SerializeField] private UnityEvent _onPress; @@ -28,7 +32,7 @@ public class PressurePlate : MonoBehaviour { triggered = Time.time; _onPress.Invoke(); - + RuntimeManager.PlayOneShot( _sfx, transform.position ); _graphics.SetActive(false); } } diff --git a/game/FMOD Project/Build/Desktop/Master.strings.bank b/game/FMOD Project/Build/Desktop/Master.strings.bank index 0e62e60..5474295 100644 --- a/game/FMOD Project/Build/Desktop/Master.strings.bank +++ b/game/FMOD Project/Build/Desktop/Master.strings.bank @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9cf3c563d0b7a7663923b6f0a966404fabeee35da625fa95982f46f98d80b4e -size 2612 +oid sha256:887a654482faef2ec53eed1846d4b2cb443dd7bcbe0dbbb01365d8986020e42e +size 2648 diff --git a/game/FMOD Project/Build/Desktop/SFX.bank b/game/FMOD Project/Build/Desktop/SFX.bank index 45335b8..487da9c 100644 --- a/game/FMOD Project/Build/Desktop/SFX.bank +++ b/game/FMOD Project/Build/Desktop/SFX.bank @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c39ff3489a1a29374429a0fde9be9ba71dc530377657fb54f2e0ddca1b965246 -size 4170016 +oid sha256:13cd27575fdefca8eb99c581a7e58feb25667b10a3ab95a3d25e9d533fc3e57f +size 4184608 diff --git a/game/FMOD Project/Metadata/AudioFile/{a072221a-e880-42a8-9a1f-6018d84388f5}.xml b/game/FMOD Project/Metadata/AudioFile/{a072221a-e880-42a8-9a1f-6018d84388f5}.xml new file mode 100644 index 0000000..6cb3673 --- /dev/null +++ b/game/FMOD Project/Metadata/AudioFile/{a072221a-e880-42a8-9a1f-6018d84388f5}.xml @@ -0,0 +1,20 @@ + + + + + CaiStuff/Enviroment/Place.mp3 + + + 44.0999985 + + + 2 + + + 1.0448979591836736 + + + {4c43130b-9186-4fb6-9d65-a9acdac70927} + + + diff --git a/game/FMOD Project/Metadata/Event/{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}.xml b/game/FMOD Project/Metadata/Event/{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}.xml new file mode 100644 index 0000000..305ecbc --- /dev/null +++ b/game/FMOD Project/Metadata/Event/{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}.xml @@ -0,0 +1,128 @@ + + + + + Button + + + 1 + + + {6af182f1-4644-4afb-a76b-0a757bed4781} + + + {f2c1f0b9-9d52-4b33-8d54-81f47ccd9721} + + + {ae5d8baa-5aec-47d4-bb9b-f257fa2e3066} + + + {fdd1243e-3436-4d21-aa93-d4da7c6b3cba} + + + {c57b1445-d762-483d-9bd2-6f1521f74d15} + + + {bd2a024e-b048-4cef-83c8-9180e2926732} + + + {849465af-7460-41bc-90fd-dcf9c8e5af81} + + + {704126a5-425d-4abd-bbf6-d0ed55de9f73} + + + {561cd480-bd2b-4c2e-b919-d775f9c4f409} + + + + + {eeedf0c5-8b0f-494c-bfaa-6a58a2123608} + + + + + {eeedf0c5-8b0f-494c-bfaa-6a58a2123608} + + + + + {bf5cee24-6c72-4e5e-b19e-8f4513813034} + + + {defefc62-0a27-4f2a-87ae-f28b609d73f1} + + + {af9d027a-3a1f-49a8-a9ef-4cbe20673632} + + + + + + + {d863b796-086d-4d64-8046-7e7ce55e1e8a} + + + {a6aa8f02-1b4f-4da4-bda2-2b4781247be3} + + + + + {d863b796-086d-4d64-8046-7e7ce55e1e8a} + + + + + {4523211f-2232-43c7-8799-5564367b6130} + + + {029f94e1-c782-43e0-bc7d-12961f86e53b} + + + {f2c1f0b9-9d52-4b33-8d54-81f47ccd9721} + + + + + {16b8546b-33db-4353-b471-ed8c578fa0ee} + + + + + + 1.0448979591836736 + + + {a072221a-e880-42a8-9a1f-6018d84388f5} + + + + + Audio 1 + + + {984cbccb-528a-4a25-ac09-1b3fe2798e45} + + + {9142ea4e-bc1d-4518-8548-c6fbede93ba3} + + + {eeedf0c5-8b0f-494c-bfaa-6a58a2123608} + + + + + {872c3fc8-d1c4-42c9-9671-875baf2e4fb3} + + + + + + + {9caaf92f-5969-4f9d-adc5-5efbdc80e7ee} + + + + + +