added plate sounds

This commit is contained in:
cyndrdev 2021-05-17 17:29:18 +01:00
parent c56cad7a9d
commit 11a4bc510e
8 changed files with 194 additions and 5 deletions

View File

@ -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: []

View File

@ -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();
}
}

View File

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

View File

@ -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);
}
}

Binary file not shown.

BIN
game/FMOD Project/Build/Desktop/SFX.bank (Stored with Git LFS)

Binary file not shown.

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects serializationModel="Studio.02.01.00">
<object class="AudioFile" id="{a072221a-e880-42a8-9a1f-6018d84388f5}">
<property name="assetPath">
<value>CaiStuff/Enviroment/Place.mp3</value>
</property>
<property name="frequencyInKHz">
<value>44.0999985</value>
</property>
<property name="channelCount">
<value>2</value>
</property>
<property name="length">
<value>1.0448979591836736</value>
</property>
<relationship name="masterAssetFolder">
<destination>{4c43130b-9186-4fb6-9d65-a9acdac70927}</destination>
</relationship>
</object>
</objects>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects serializationModel="Studio.02.01.00">
<object class="Event" id="{4a251740-3d73-49b0-8b5f-cbf8a6b7bab9}">
<property name="name">
<value>Button</value>
</property>
<property name="outputFormat">
<value>1</value>
</property>
<relationship name="folder">
<destination>{6af182f1-4644-4afb-a76b-0a757bed4781}</destination>
</relationship>
<relationship name="mixer">
<destination>{f2c1f0b9-9d52-4b33-8d54-81f47ccd9721}</destination>
</relationship>
<relationship name="masterTrack">
<destination>{ae5d8baa-5aec-47d4-bb9b-f257fa2e3066}</destination>
</relationship>
<relationship name="mixerInput">
<destination>{fdd1243e-3436-4d21-aa93-d4da7c6b3cba}</destination>
</relationship>
<relationship name="automatableProperties">
<destination>{c57b1445-d762-483d-9bd2-6f1521f74d15}</destination>
</relationship>
<relationship name="markerTracks">
<destination>{bd2a024e-b048-4cef-83c8-9180e2926732}</destination>
</relationship>
<relationship name="groupTracks">
<destination>{849465af-7460-41bc-90fd-dcf9c8e5af81}</destination>
</relationship>
<relationship name="timeline">
<destination>{704126a5-425d-4abd-bbf6-d0ed55de9f73}</destination>
</relationship>
<relationship name="banks">
<destination>{561cd480-bd2b-4c2e-b919-d775f9c4f409}</destination>
</relationship>
</object>
<object class="EventMixer" id="{f2c1f0b9-9d52-4b33-8d54-81f47ccd9721}">
<relationship name="masterBus">
<destination>{eeedf0c5-8b0f-494c-bfaa-6a58a2123608}</destination>
</relationship>
</object>
<object class="MasterTrack" id="{ae5d8baa-5aec-47d4-bb9b-f257fa2e3066}">
<relationship name="mixerGroup">
<destination>{eeedf0c5-8b0f-494c-bfaa-6a58a2123608}</destination>
</relationship>
</object>
<object class="MixerInput" id="{fdd1243e-3436-4d21-aa93-d4da7c6b3cba}">
<relationship name="effectChain">
<destination>{bf5cee24-6c72-4e5e-b19e-8f4513813034}</destination>
</relationship>
<relationship name="panner">
<destination>{defefc62-0a27-4f2a-87ae-f28b609d73f1}</destination>
</relationship>
<relationship name="output">
<destination>{af9d027a-3a1f-49a8-a9ef-4cbe20673632}</destination>
</relationship>
</object>
<object class="EventAutomatableProperties" id="{c57b1445-d762-483d-9bd2-6f1521f74d15}" />
<object class="MarkerTrack" id="{bd2a024e-b048-4cef-83c8-9180e2926732}" />
<object class="GroupTrack" id="{849465af-7460-41bc-90fd-dcf9c8e5af81}">
<relationship name="modules">
<destination>{d863b796-086d-4d64-8046-7e7ce55e1e8a}</destination>
</relationship>
<relationship name="mixerGroup">
<destination>{a6aa8f02-1b4f-4da4-bda2-2b4781247be3}</destination>
</relationship>
</object>
<object class="Timeline" id="{704126a5-425d-4abd-bbf6-d0ed55de9f73}">
<relationship name="modules">
<destination>{d863b796-086d-4d64-8046-7e7ce55e1e8a}</destination>
</relationship>
</object>
<object class="EventMixerMaster" id="{eeedf0c5-8b0f-494c-bfaa-6a58a2123608}">
<relationship name="effectChain">
<destination>{4523211f-2232-43c7-8799-5564367b6130}</destination>
</relationship>
<relationship name="panner">
<destination>{029f94e1-c782-43e0-bc7d-12961f86e53b}</destination>
</relationship>
<relationship name="mixer">
<destination>{f2c1f0b9-9d52-4b33-8d54-81f47ccd9721}</destination>
</relationship>
</object>
<object class="MixerBusEffectChain" id="{bf5cee24-6c72-4e5e-b19e-8f4513813034}">
<relationship name="effects">
<destination>{16b8546b-33db-4353-b471-ed8c578fa0ee}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{defefc62-0a27-4f2a-87ae-f28b609d73f1}" />
<object class="SingleSound" id="{d863b796-086d-4d64-8046-7e7ce55e1e8a}">
<property name="length">
<value>1.0448979591836736</value>
</property>
<relationship name="audioFile">
<destination>{a072221a-e880-42a8-9a1f-6018d84388f5}</destination>
</relationship>
</object>
<object class="EventMixerGroup" id="{a6aa8f02-1b4f-4da4-bda2-2b4781247be3}">
<property name="name">
<value>Audio 1</value>
</property>
<relationship name="effectChain">
<destination>{984cbccb-528a-4a25-ac09-1b3fe2798e45}</destination>
</relationship>
<relationship name="panner">
<destination>{9142ea4e-bc1d-4518-8548-c6fbede93ba3}</destination>
</relationship>
<relationship name="output">
<destination>{eeedf0c5-8b0f-494c-bfaa-6a58a2123608}</destination>
</relationship>
</object>
<object class="MixerBusEffectChain" id="{4523211f-2232-43c7-8799-5564367b6130}">
<relationship name="effects">
<destination>{872c3fc8-d1c4-42c9-9671-875baf2e4fb3}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{029f94e1-c782-43e0-bc7d-12961f86e53b}" />
<object class="MixerBusFader" id="{16b8546b-33db-4353-b471-ed8c578fa0ee}" />
<object class="MixerBusEffectChain" id="{984cbccb-528a-4a25-ac09-1b3fe2798e45}">
<relationship name="effects">
<destination>{9caaf92f-5969-4f9d-adc5-5efbdc80e7ee}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{9142ea4e-bc1d-4518-8548-c6fbede93ba3}" />
<object class="MixerBusFader" id="{872c3fc8-d1c4-42c9-9671-875baf2e4fb3}" />
<object class="MixerBusFader" id="{9caaf92f-5969-4f9d-adc5-5efbdc80e7ee}" />
</objects>