Adding server room sound effects and button to trigger them

This commit is contained in:
Ranno Samuel Adson
2025-01-02 16:37:16 +02:00
parent de968605ec
commit 98094a9f5f
22 changed files with 574 additions and 6 deletions

View File

@@ -55,6 +55,10 @@ namespace UnityEngine.XR.Content.Interaction
[SerializeField]
[Tooltip("Events to trigger when the button pressed value is updated. Only called when the button is pressed")]
ValueChangeEvent m_OnValueChange;
[SerializeField]
[Tooltip("Audio source to play when the button is pressed")]
AudioSource m_AudioSource;
bool m_Pressed = false;
bool m_Toggled = false;
@@ -247,6 +251,11 @@ namespace UnityEngine.XR.Content.Interaction
{
if (m_Pressed)
m_OnRelease.Invoke();
// Play sound if the audio source is set
if (m_AudioSource != null)
{
m_AudioSource.Play();
}
}
}
m_Pressed = pressed;