diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab index e343107..64409e2 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab @@ -1119,6 +1119,10 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 7516989854395125640, guid: d2d6934a666a18d46b8b7a3864dc9f63, type: 3} + propertyPath: m_TagString + value: SB + objectReference: {fileID: 0} - target: {fileID: 7516989854707263118, guid: d2d6934a666a18d46b8b7a3864dc9f63, type: 3} propertyPath: m_LocalScale.x value: 0.89236 @@ -1482,6 +1486,10 @@ PrefabInstance: propertyPath: ObservedComponents.Array.data[1] value: objectReference: {fileID: 4890728645620921254} + - target: {fileID: 4293156748659161764, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: m_TagString + value: EB + objectReference: {fileID: 0} - target: {fileID: 4293156748659161770, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: m_LocalPosition.y value: -132.3 diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 0fb3816..b456362 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -68,13 +68,22 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable photonView = PhotonView.Get(this); photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All,false,0.0f); - + + avatar = GameObject.FindGameObjectWithTag("Avatar"); + audioControllerScript = avatar.GetComponent<AudioController>(); + + + // Turning on both the buttons on GUI when something is playing + transform.GetChild(1).gameObject.SetActive(false); + transform.GetChild(3).gameObject.SetActive(false); } void Update() { if (isButtonPressed) { + webSocketController = GameObject.FindGameObjectWithTag("WebController"); + webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); if (webSocketControllerScript.ws.ReadyState != WebSocketState.Open) { webSocketControllerScript.ws.Connect(); @@ -83,6 +92,14 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable photonView.RPC("RPC_VoltageUpdate", RpcTarget.All, webSocketControllerScript.voltageValue.ToString()); } + + if (audioControllerScript.audioSource.isActiveAndEnabled && !audioControllerScript.audioSource.isPlaying) + { + // Turning off both the buttons on GUI when something is playing + transform.GetChild(1).gameObject.SetActive(true); + transform.GetChild(3).gameObject.SetActive(true); + } + } public void OnButtonClick() @@ -94,10 +111,11 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable webSocketControllerScript.ConnectWithESP32(); StartCoroutine(GetText()); - avatar = GameObject.FindGameObjectWithTag("Avatar"); - audioControllerScript = avatar.GetComponent<AudioController>(); + audioControllerScript.fn_call_AudioNarration2(); Debug.Log("Button is Clicked"); + transform.GetChild(1).gameObject.SetActive(false); + transform.GetChild(3).gameObject.SetActive(false); } } diff --git a/Assets/SharedSpatialAnchors/Scripts/AudioController.cs b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs index fef184d..ef387a5 100644 --- a/Assets/SharedSpatialAnchors/Scripts/AudioController.cs +++ b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs @@ -5,7 +5,7 @@ using Photon.Pun; public class AudioController : MonoBehaviour { - AudioSource audioSource; + public AudioSource audioSource; public AudioClip audioNarration_1; public AudioClip audioNarration_2; PhotonView photonView; @@ -55,6 +55,8 @@ public class AudioController : MonoBehaviour { yield return new WaitForSeconds(0.0f); audioSource.PlayOneShot(audioNarration_2); + yield return new WaitForSeconds(audioNarration_2.length+2.0f); + audioSource.gameObject.SetActive(false); } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index e252863..6bf4374 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -10,6 +10,8 @@ TagManager: - Avatar - map - Wind_Turbine_withMap + - EB + - SB layers: - Default - TransparentFX