From 90de0fc7a344db0303eac4bb9640aa6ebddfcbf0 Mon Sep 17 00:00:00 2001 From: Abdul Mukheem Shaik <mukheemuddin@gmail.com> Date: Mon, 27 May 2024 21:21:19 +0200 Subject: [PATCH] RPC for a variable to see if WT is rotating or not Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com> --- Assets/SharedSpatialAnchors/Scripts/API.cs | 7 ++++--- .../Scripts/NetworkedAttribute.cs | 5 +++++ .../Scripts/NetworkedAttribute.cs.meta | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs create mode 100644 Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs.meta diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 7715f1f..ca86b0f 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -55,6 +55,7 @@ public class API : MonoBehaviour PhotonView photonView; private GameObject avatar; private AudioController audioControllerScript; + [PunRPC] public bool turn_WT_on_Y_Axis = false; void Start() @@ -176,18 +177,18 @@ public void ExtractDataFromJson(string json) } } photonView = PhotonView.Get(this); - photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s"); + photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s",true); } [PunRPC] - public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed) + public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val) { Debug.Log("Latest WS is - " + windSpeed); windDirValue.SetText(windDirection); temperatureValue.SetText(locationTemperature); loc.SetText(location); windSpeedValue.SetText(windSpeed); - turn_WT_on_Y_Axis = true; // flag set to true so that WT can rotate on it's Y axis. + 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. } [PunRPC] public void RPC_VoltageUpdate(String voltageGenerated) diff --git a/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs b/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs new file mode 100644 index 0000000..7d7464e --- /dev/null +++ b/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs @@ -0,0 +1,5 @@ +using System; + +internal class NetworkedAttribute : Attribute +{ +} \ No newline at end of file diff --git a/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs.meta b/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs.meta new file mode 100644 index 0000000..780a8aa --- /dev/null +++ b/Assets/SharedSpatialAnchors/Scripts/NetworkedAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5abaf289b293084480009e235498473 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: