From 015e8a28d5a44de89b137651ec3fdb2b281f40a5 Mon Sep 17 00:00:00 2001 From: Syed Hussain Ather Date: Sat, 31 May 2025 01:18:01 -0400 Subject: [PATCH] feat(multiplayer): Add EEGSyncManager for real-time brainwave syncing --- Assets/Scripts/Networking/EEGSyncManager.cs | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Assets/Scripts/Networking/EEGSyncManager.cs 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; + } +} +