Added RPC to make WT Turn work only when user presses green button

This commit is contained in:
Abdul Mukheem Shaik 2024-05-26 16:25:16 +02:00
parent 2604d55fc1
commit 9c8a5f8fb3
13 changed files with 189 additions and 1 deletions

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 99ebf73cea974b24fbaa751df176d2c0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ebfc49f8158f4f45bab1ca9422ea35a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 9b80a823b03707d42a56551b996ed9be
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: d04b5fce2c9627f4483faa6f2951f454
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b536b3fe2c90f5c4b975678a907a8478
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 2507559d8d0f1cc4ca0ba02c5e3a33a4
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 1804cdfd62684924aad3bbc22963b2ca
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91e0783b001c5b84db00051164c5a138
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c6bbf16acd5664e4da08d29e6dccd73f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f19ef78b3b23cc645a00e50d78dc69c4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -12,6 +12,8 @@ GameObject:
- component: {fileID: 382264866493358940}
- component: {fileID: 382264866492359068}
- component: {fileID: 5204658000653702064}
- component: {fileID: 2369382148363411835}
- component: {fileID: 5762830989053361383}
m_Layer: 0
m_Name: wind_turbine_0001_rotor
m_TagString: WindTurbine
@ -97,6 +99,45 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
speed: 0
--- !u!114 &2369382148363411835
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 382264866490105688}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3}
m_Name:
m_EditorClassIdentifier:
ObservedComponentsFoldoutOpen: 1
Group: 0
prefixField: -1
Synchronization: 3
OwnershipTransfer: 0
observableSearch: 2
ObservedComponents:
- {fileID: 5762830989053361383}
sceneViewId: 0
InstantiationId: 0
isRuntimeInstantiated: 0
--- !u!114 &5762830989053361383
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 382264866490105688}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 627855c7f81362d41938ffe0b1475957, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SynchronizePosition: 1
m_SynchronizeRotation: 1
m_SynchronizeScale: 1
m_UseLocal: 1
--- !u!1 &382264866490105690
GameObject:
m_ObjectHideFlags: 0

@ -52,6 +52,7 @@ MonoBehaviour:
- RPC_EmergencyButtonClick
- RPC_GreenButtonClick
- RPC_VoltageUpdate
- RPC_WT_Turn
DisableAutoOpenWizard: 1
ShowSettings: 1
DevRegionSetOnce: 1

@ -1,3 +1,4 @@
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -8,6 +9,7 @@ public class Windturbine : MonoBehaviour
public float speed;
private API apiScript;
private GameObject GUIdataGameObject;
PhotonView photonView;
// Start is called before the first frame update
void Start()
{
@ -19,9 +21,19 @@ public class Windturbine : MonoBehaviour
// Update is called once per frame
void Update()
{
photonView = PhotonView.Get(this);
photonView.RPC("RPC_WT_Turn", RpcTarget.All);
}
[PunRPC]
public void RPC_WT_Turn()
{
Debug.Log("WIND SPEED FROM API SCRIPT:" + apiScript.latestWS);
transform.localEulerAngles = new Vector3(0.0f, 0.0f, angle);
angle += Time.deltaTime * (apiScript.latestWS*10);
angle += Time.deltaTime * (apiScript.latestWS * 10);
}
}