diff --git a/Assets/Scripts/Networking/EEGSyncManager.cs b/Assets/Scripts/Networking/EEGSyncManager.cs new file mode 100644 index 0000000..e6977d7 --- /dev/null +++ b/Assets/Scripts/Networking/EEGSyncManager.cs @@ -0,0 +1,36 @@ +using Unity.Netcode; +using UnityEngine; + +public class EEGSyncManager : NetworkBehaviour +{ + public static EEGSyncManager Instance; + + [Header("EEG Sync Data")] + public NetworkVariable syncedAttentionLevel = new NetworkVariable( + 0f, + NetworkVariableReadPermission.Everyone, + NetworkVariableWritePermission.Owner + ); + + private void Awake() + { + if (Instance == null) + { + Instance = this; + } + } + + public void UpdateAttentionLevel(float newLevel) + { + if (IsOwner) + { + syncedAttentionLevel.Value = newLevel; + } + } + + public float GetRemoteAttentionLevel() + { + return syncedAttentionLevel.Value; + } +} +