From 2f7eac05cede03ad7a36313b9bb062cd962a1b8b Mon Sep 17 00:00:00 2001 From: dal4segno Date: Wed, 25 Feb 2026 21:26:11 +0900 Subject: [PATCH] =?UTF-8?q?=ED=81=B4=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8?= =?UTF-8?q?=EC=97=90=EA=B2=8C=20=EC=8B=9C=EC=95=BC=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=EA=B0=80=20=EA=B3=B5=EC=9C=A0=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/FogOfWarSystem.cs | 11 +++++++++-- Assets/Scripts/PlayerVisionProvider.cs | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/FogOfWarSystem.cs b/Assets/Scripts/FogOfWarSystem.cs index 9614238..fd27d62 100644 --- a/Assets/Scripts/FogOfWarSystem.cs +++ b/Assets/Scripts/FogOfWarSystem.cs @@ -355,7 +355,7 @@ namespace Northbound Vector3 position = provider.GetTransform().position; float visionRange = provider.GetVisionRange(); - + RevealArea(ownerId, position, visionRange); } @@ -365,11 +365,18 @@ namespace Northbound ulong clientId = kvp.Key; FogOfWarData fogData = kvp.Value; + // 해당 클라이언트가 여전히 연결되어 있는지 확인 + if (NetworkManager.Singleton == null || + !NetworkManager.Singleton.ConnectedClients.ContainsKey(clientId)) + { + continue; + } + // 압축된 데이터로 전송 byte[] visibleData = fogData.GetVisibleData(); byte[] exploredData = fogData.GetExploredData(); - SendFogDataToClientRpc(visibleData, exploredData, + SendFogDataToClientRpc(visibleData, exploredData, new ClientRpcParams { Send = new ClientRpcSendParams diff --git a/Assets/Scripts/PlayerVisionProvider.cs b/Assets/Scripts/PlayerVisionProvider.cs index 46f9799..17c8c88 100644 --- a/Assets/Scripts/PlayerVisionProvider.cs +++ b/Assets/Scripts/PlayerVisionProvider.cs @@ -9,10 +9,12 @@ namespace Northbound public class PlayerVisionProvider : NetworkBehaviour, IVisionProvider { private PlayerStats _playerStats; + private NetworkPlayerController _playerController; public override void OnNetworkSpawn() { _playerStats = GetComponent(); + _playerController = GetComponent(); if (IsServer) { FogOfWarSystem.Instance?.RegisterVisionProvider(this); @@ -27,7 +29,9 @@ namespace Northbound } } - public ulong GetOwnerId() => OwnerClientId; + // NetworkPlayerController.OwnerPlayerId 사용 (실제 플레이어 ID) + // OwnerClientId는 서버 소유권이므로 잘못된 ID 반환 + public ulong GetOwnerId() => _playerController?.OwnerPlayerId ?? OwnerClientId; public float GetVisionRange() => _playerStats?.GetSight() ?? 10f; public Transform GetTransform() => transform; public bool IsActive() => IsSpawned;