From 08d350dd7ca3d3fe3a2692d780d4cbc6e97886ba Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 01:58:01 +0200
Subject: [PATCH 1/9] Implemented Inheritence

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 11 +++--------
 Assets/Wind_Turbine/Scripts/Windturbine.cs | 19 ++++++++++---------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 7f97ace..54c00d0 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -58,9 +58,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
     private AudioController audioControllerScript;
     public bool turn_WT_on_Y_Axis = false;
 
-    public GameObject windTurbineWithMap;
-    private GameObject windTurbineController;
-    private Windturbine windTurbineControllerScript;
+  
 
     void Start()
     {
@@ -70,8 +68,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
         photonView = PhotonView.Get(this);
         photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All);
 
-        windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap");
-
+        
     }
 
     void Update()
@@ -182,8 +179,6 @@ public void ExtractDataFromJson(string json)
                 Debug.Log("Latest WS is - "+latestWS);
             }
         }
-        windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject;
-        windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>();
         photonView = PhotonView.Get(this);
         photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s",true);
     }
@@ -201,7 +196,7 @@ public void ExtractDataFromJson(string json)
 
         Debug.Log("Flag value to turn the Y Axis:" + turn_WT_on_Y_Axis);
         
-        windTurbineControllerScript.WT_TurnOnIts_Y_Axis();
+        //windTurbineControllerScript.WT_TurnOnIts_Y_Axis();
     }
     [PunRPC]
     public void RPC_VoltageUpdate(String voltageGenerated)
diff --git a/Assets/Wind_Turbine/Scripts/Windturbine.cs b/Assets/Wind_Turbine/Scripts/Windturbine.cs
index 3b4e31b..2bfdcf2 100644
--- a/Assets/Wind_Turbine/Scripts/Windturbine.cs
+++ b/Assets/Wind_Turbine/Scripts/Windturbine.cs
@@ -3,12 +3,12 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
-public class Windturbine : MonoBehaviour
+public class Windturbine : API
 {
     float angle;
     public float speed;
-    private API apiScript;
-    private GameObject GUIdataGameObject;
+    //private API apiScript;
+    //private GameObject GUIdataGameObject;
     PhotonView photonView;
 
     public float startRotationY = 0f;
@@ -21,8 +21,8 @@ public class Windturbine : MonoBehaviour
     {
         angle = Random.Range(0.0f, 120.0f);    
         speed = Random.Range(75.0f, 86.0f);
-        GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData");
-        apiScript = GUIdataGameObject.GetComponent<API>();
+        //GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData");
+        //apiScript = GUIdataGameObject.GetComponent<API>();
 
         //THis condition is to detach the map with the Wind turbine after Instantiating. This helps the map stick to the ground when the turbine rotates.
         GameObject.FindGameObjectWithTag("map").transform.SetParent(null); ;
@@ -35,10 +35,10 @@ public class Windturbine : MonoBehaviour
         photonView = PhotonView.Get(this);
         photonView.RPC("RPC_WT_Turn", RpcTarget.All);
 
-        if(apiScript.turn_WT_on_Y_Axis)
+        if(turn_WT_on_Y_Axis) //From Base class
         {
             WT_TurnOnIts_Y_Axis();
-            apiScript.turn_WT_on_Y_Axis = false;
+            turn_WT_on_Y_Axis = false;
         }
     }
 
@@ -48,7 +48,7 @@ public class Windturbine : MonoBehaviour
     {
         //Debug.Log("WIND SPEED FROM API SCRIPT:" + apiScript.latestWS);
         transform.localEulerAngles = new Vector3(0.0f, 0.0f, angle);
-        angle += Time.deltaTime * (apiScript.latestWS * 10); // as the value we are fetching could not turn the blades completely, Multiplying the value we are fetching from API by 10.
+        angle += Time.deltaTime * (latestWS * 10); // as the value we are fetching could not turn the blades completely, Multiplying the value we are fetching from API by 10.
 
     }
 
@@ -62,13 +62,14 @@ public class Windturbine : MonoBehaviour
     public void RPC_WT_TurnOnIts_Y_Axis()
     {
         Debug.Log("Rotate On it's Y-Axis");
-        endRotationY = apiScript.latestWD;
+        endRotationY = latestWD;
         StartCoroutine(RotateObject(startRotationY, endRotationY, 3.5f));
     }
 
     // Method to turn the 'Turbine' on its Y axis as per the DIRECTION of wind that is fetched from API
     IEnumerator RotateObject(float startAngle, float endAngle, float duration)
     {
+        Debug.Log("Rotate On it's Y-Axis- COROUTINE");
         yield return new WaitForSeconds(2f);
         float timeElapsed = 0f;
         Quaternion startRotation = Quaternion.Euler(0, startAngle, 0);

From 5c387c5f99acbe5ccb2cfc1045b72f8d693a4c59 Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 02:39:59 +0200
Subject: [PATCH 2/9] Rotation references issue working single user

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs    |  2 +-
 .../Scripts/WebSocketController.cs            |  4 ++--
 Assets/Wind_Turbine/Scripts/Windturbine.cs    | 20 ++++++++++---------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 54c00d0..70d1ee8 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -95,7 +95,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
         avatar = GameObject.FindGameObjectWithTag("Avatar");
         audioControllerScript = avatar.GetComponent<AudioController>();
         audioControllerScript.fn_call_AudioNarration2();
-
+        Debug.Log("Button is Clicked");
     }
 
     [PunRPC]
diff --git a/Assets/SharedSpatialAnchors/Scripts/WebSocketController.cs b/Assets/SharedSpatialAnchors/Scripts/WebSocketController.cs
index 4501bd5..7f9c9cb 100644
--- a/Assets/SharedSpatialAnchors/Scripts/WebSocketController.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/WebSocketController.cs
@@ -42,10 +42,10 @@ public class WebSocketController : MonoBehaviour
         };
         ws.OnMessage += (sender, e) =>
         {
-            Debug.Log("Received message: " + e.Data);
+            //Debug.Log("Received message: " + e.Data);
             //Debug.Log();
             voltageValue = e.Data.Split(':')[1].ToString();
-            Debug.Log(voltageValue);
+           // Debug.Log(voltageValue);
             //Voltage:180.0
             if (e.Data.Equals("Start Narration", StringComparison.OrdinalIgnoreCase)){
                // narrationControllerScript.startNarration = true;
diff --git a/Assets/Wind_Turbine/Scripts/Windturbine.cs b/Assets/Wind_Turbine/Scripts/Windturbine.cs
index 2bfdcf2..44e5aea 100644
--- a/Assets/Wind_Turbine/Scripts/Windturbine.cs
+++ b/Assets/Wind_Turbine/Scripts/Windturbine.cs
@@ -3,12 +3,12 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
-public class Windturbine : API
+public class Windturbine : MonoBehaviour
 {
     float angle;
     public float speed;
-    //private API apiScript;
-    //private GameObject GUIdataGameObject;
+    private API apiScript;
+    private GameObject GUIdataGameObject;
     PhotonView photonView;
 
     public float startRotationY = 0f;
@@ -21,8 +21,8 @@ public class Windturbine : API
     {
         angle = Random.Range(0.0f, 120.0f);    
         speed = Random.Range(75.0f, 86.0f);
-        //GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData");
-        //apiScript = GUIdataGameObject.GetComponent<API>();
+        GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData");
+        apiScript = GUIdataGameObject.GetComponent<API>();
 
         //THis condition is to detach the map with the Wind turbine after Instantiating. This helps the map stick to the ground when the turbine rotates.
         GameObject.FindGameObjectWithTag("map").transform.SetParent(null); ;
@@ -35,11 +35,13 @@ public class Windturbine : API
         photonView = PhotonView.Get(this);
         photonView.RPC("RPC_WT_Turn", RpcTarget.All);
 
-        if(turn_WT_on_Y_Axis) //From Base class
+        if(apiScript.turn_WT_on_Y_Axis) //From Base class
         {
+            Debug.Log("FLAG IS TRUE");
             WT_TurnOnIts_Y_Axis();
-            turn_WT_on_Y_Axis = false;
+            apiScript.turn_WT_on_Y_Axis = false;
         }
+       
     }
 
     // Method to turn the 'Turbine blades' as per the SPEED of wind that is fetched from API
@@ -48,7 +50,7 @@ public class Windturbine : API
     {
         //Debug.Log("WIND SPEED FROM API SCRIPT:" + apiScript.latestWS);
         transform.localEulerAngles = new Vector3(0.0f, 0.0f, angle);
-        angle += Time.deltaTime * (latestWS * 10); // as the value we are fetching could not turn the blades completely, Multiplying the value we are fetching from API by 10.
+        angle += Time.deltaTime * (apiScript.latestWS * 10); // as the value we are fetching could not turn the blades completely, Multiplying the value we are fetching from API by 10.
 
     }
 
@@ -62,7 +64,7 @@ public class Windturbine : API
     public void RPC_WT_TurnOnIts_Y_Axis()
     {
         Debug.Log("Rotate On it's Y-Axis");
-        endRotationY = latestWD;
+        endRotationY = apiScript.latestWD;
         StartCoroutine(RotateObject(startRotationY, endRotationY, 3.5f));
     }
 

From 36fdae0a6d8df25f958e1abcd6e5f89f6d38c329 Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 03:04:25 +0200
Subject: [PATCH 3/9] streaming isButtonpressed variable as well

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 70d1ee8..0ab81e4 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -47,7 +47,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
     public TextMeshProUGUI windSpeedValue;
     private float LatestT;
     public float latestWD = 0.0f;
-    public float latestWS;
+    public float latestWS = 0.01f;
     private String windDirectionInDirectionTerms;
     private string unit;
     private GameObject webSocketController;
@@ -220,10 +220,12 @@ public void ExtractDataFromJson(string json)
         if (stream.IsWriting)
         {
             stream.SendNext(turn_WT_on_Y_Axis);
+            stream.SendNext(isButtonPressed);
         }
         else
         {
             turn_WT_on_Y_Axis = (bool)stream.ReceiveNext();
+            isButtonPressed = (bool)stream.ReceiveNext();
         }
     }
 }

From ace58ebb957b258b25557df15c1ab7b647c1c9ff Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 03:21:54 +0200
Subject: [PATCH 4/9] latestWD and LatestWS are now serialised on PUN

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 0ab81e4..2a38ad7 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -8,7 +8,7 @@ using TMPro;
 using UnityEngine;
 using UnityEngine.Networking;
 using WebSocketSharp;
-using System.Linq;
+
 //https://github.com/GlitchEnzo/NuGetForUnity
 // Creating the data structure according to the expected Json
 [Serializable]
@@ -186,6 +186,8 @@ public void ExtractDataFromJson(string json)
     [PunRPC]
     public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val)
     {
+        latestWD = float.Parse(windDirection);
+        latestWS = float.Parse(windSpeed);
         Debug.Log("Latest WS is - " + windSpeed);
         windDirValue.SetText(windDirection);
         temperatureValue.SetText(locationTemperature);

From 2555c1c8b815eafbd9f7f8e5e0d1ef7191abf4ae Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 03:35:19 +0200
Subject: [PATCH 5/9] latestWD and LatestWS are now serialised on PUN - 2

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 2a38ad7..be5d59a 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -180,14 +180,14 @@ public void ExtractDataFromJson(string json)
             }
         }
         photonView = PhotonView.Get(this);
-        photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s",true);
+        photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s",true,latestWD,latestWS);
     }
 
     [PunRPC]
-    public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val)
+    public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val,float latestWD_val, float latestWS_val)
     {
-        latestWD = float.Parse(windDirection);
-        latestWS = float.Parse(windSpeed);
+        latestWD = latestWD_val;
+        latestWS = latestWS_val;
         Debug.Log("Latest WS is - " + windSpeed);
         windDirValue.SetText(windDirection);
         temperatureValue.SetText(locationTemperature);

From 898a4249e19eced000a3e3deea937b8cbd0aed3f Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 03:48:01 +0200
Subject: [PATCH 6/9] WT rotates for multi user

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index be5d59a..f425a2c 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -186,6 +186,7 @@ public void ExtractDataFromJson(string json)
     [PunRPC]
     public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val,float latestWD_val, float latestWS_val)
     {
+        
         latestWD = latestWD_val;
         latestWS = latestWS_val;
         Debug.Log("Latest WS is - " + windSpeed);

From ecbb28e6911f2e6cf443b78d3342906dee96b406 Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 04:03:36 +0200
Subject: [PATCH 7/9] Emergency button RPC calls fixed - 1

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index f425a2c..a0a1880 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -66,7 +66,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
         //TestFromJsonToData();
         //EmergencyButtonClick();
         photonView = PhotonView.Get(this);
-        photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All);
+        photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All,false,0.0f);
 
         
     }
@@ -97,11 +97,16 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
         audioControllerScript.fn_call_AudioNarration2();
         Debug.Log("Button is Clicked");
     }
-
+    public void emergencyButtonClick()
+    {
+        photonView = PhotonView.Get(this);
+        photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All, false, 0.0f);
+    }
     [PunRPC]
-    public void RPC_EmergencyButtonClick()
+    public void RPC_EmergencyButtonClick(bool isButtonPressedVal, float latestWS_val)
     {
         isButtonPressed = false;
+        webSocketControllerScript.ws.Close();
         loc.SetText("----");
         windDirValue.SetText("----");
         temperatureValue.SetText("----");
@@ -187,19 +192,14 @@ public void ExtractDataFromJson(string json)
     public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val,float latestWD_val, float latestWS_val)
     {
         
-        latestWD = latestWD_val;
-        latestWS = latestWS_val;
-        Debug.Log("Latest WS is - " + windSpeed);
+        latestWD = latestWD_val; // Just for RPC purposes
+        latestWS = latestWS_val; // Just for RPC purposes
         windDirValue.SetText(windDirection);
         temperatureValue.SetText(locationTemperature);
         loc.SetText(location);
         windSpeedValue.SetText(windSpeed);
         turn_WT_on_Y_Axis = turn_WT_on_Y_Axis_val; // flag set to true so that WT can rotate on it's Y axis.
-
-
-        Debug.Log("Flag value to turn the Y Axis:" + turn_WT_on_Y_Axis);
         
-        //windTurbineControllerScript.WT_TurnOnIts_Y_Axis();
     }
     [PunRPC]
     public void RPC_VoltageUpdate(String voltageGenerated)

From 1a319b1f791f9ce4c443033706e3b9aceb9648e4 Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 04:28:09 +0200
Subject: [PATCH 8/9] testing for Emergency button click

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab | 8 ++++----
 Assets/SharedSpatialAnchors/Scripts/API.cs               | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab
index 08ac981..e343107 100644
--- a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab
+++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab
@@ -1472,16 +1472,16 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: ObservedComponents.Array.size
-      value: 1
+      value: 2
       objectReference: {fileID: 0}
     - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: ObservedComponents.Array.data[0]
       value: 
-      objectReference: {fileID: 4890728645620921254}
+      objectReference: {fileID: 1160440965950818012}
     - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: ObservedComponents.Array.data[1]
       value: 
-      objectReference: {fileID: 0}
+      objectReference: {fileID: 4890728645620921254}
     - target: {fileID: 4293156748659161770, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: m_LocalPosition.y
       value: -132.3
@@ -1532,7 +1532,7 @@ PrefabInstance:
       objectReference: {fileID: 1160440965950818012}
     - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
-      value: RPC_EmergencyButtonClick
+      value: emergencyButtonClick
       objectReference: {fileID: 0}
     - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3}
       propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index a0a1880..49caca9 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -105,13 +105,15 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
     [PunRPC]
     public void RPC_EmergencyButtonClick(bool isButtonPressedVal, float latestWS_val)
     {
-        isButtonPressed = false;
-        webSocketControllerScript.ws.Close();
+        isButtonPressed = isButtonPressedVal;
+        latestWD = latestWS_val;
+        
         loc.SetText("----");
         windDirValue.SetText("----");
         temperatureValue.SetText("----");
         voltageValue.SetText("----");
         windSpeedValue.SetText("----");
+        
     }
     IEnumerator GetText()
     {

From 7bd9c226bc03e857c310eb5ed6be911900772486 Mon Sep 17 00:00:00 2001
From: Abdul Mukheem Shaik <mukheemuddin@gmail.com>
Date: Tue, 28 May 2024 04:39:41 +0200
Subject: [PATCH 9/9] cosmetic change

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
---
 Assets/SharedSpatialAnchors/Scripts/API.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs
index 49caca9..47838ea 100644
--- a/Assets/SharedSpatialAnchors/Scripts/API.cs
+++ b/Assets/SharedSpatialAnchors/Scripts/API.cs
@@ -106,7 +106,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable
     public void RPC_EmergencyButtonClick(bool isButtonPressedVal, float latestWS_val)
     {
         isButtonPressed = isButtonPressedVal;
-        latestWD = latestWS_val;
+        latestWS = latestWS_val;
         
         loc.SetText("----");
         windDirValue.SetText("----");