mirror of
https://github.com/Mukheem/TwinTurbine.git
synced 2025-04-27 10:10:34 +02:00
Button click fix
This commit is contained in:
parent
cdbee665a2
commit
2075ee86a8
Assets/SharedSpatialAnchors
ProjectSettings
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,8 @@ TagManager:
|
||||
- Avatar
|
||||
- map
|
||||
- Wind_Turbine_withMap
|
||||
- EB
|
||||
- SB
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
Loading…
x
Reference in New Issue
Block a user