RPC applied to Voltage also

This commit is contained in:
Abdul Mukheem Shaik 2024-05-24 22:47:33 +02:00
parent aad7bdc7f1
commit 301d4dee84

@ -68,8 +68,9 @@ public class API : MonoBehaviour
{
if (isButtonPressed)
{
Debug.Log("Inside Update");
voltageValue.text = webSocketControllerScript.voltageValue.ToString();
photonView = PhotonView.Get(this);
photonView.RPC("RPC_VoltageUpdate", RpcTarget.All, webSocketControllerScript.voltageValue.ToString());
}
}
@ -169,6 +170,12 @@ public void ExtractDataFromJson(string json)
loc.SetText(location);
windSpeedValue.SetText(windSpeed);
}
[PunRPC]
public void RPC_VoltageUpdate(String voltageGenerated)
{
Debug.Log("Voltge generated is - " + voltageGenerated);
voltageValue.text = voltageGenerated;
}
public string GetWindDirection(float degrees)
{
// Ensure degrees are within the range 0 to 359