Adding server room sound effects and button to trigger them
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user