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)); }