클라이언트에서 밝혀지지 않은 곳의 적이 보이는 문제 수정
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Northbound
|
||||
private Material[] _originalMaterials;
|
||||
private bool _isVisible = false;
|
||||
private float _updateTimer;
|
||||
private ulong _localClientId;
|
||||
private ulong _localPlayerId;
|
||||
private bool _isInitialized = false;
|
||||
private float _objectHeight = 0f;
|
||||
|
||||
@@ -130,7 +130,13 @@ namespace Northbound
|
||||
{
|
||||
if (NetworkManager.Singleton != null && NetworkManager.Singleton.IsClient)
|
||||
{
|
||||
_localClientId = NetworkManager.Singleton.LocalClientId;
|
||||
_localPlayerId = GetLocalPlayerId();
|
||||
if (_localPlayerId == ulong.MaxValue)
|
||||
{
|
||||
// Local player not found yet - stay hidden
|
||||
SetVisible(false);
|
||||
return;
|
||||
}
|
||||
_isInitialized = true;
|
||||
|
||||
// Force immediate visibility update on initialization
|
||||
@@ -152,6 +158,26 @@ namespace Northbound
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 로컬 플레이어의 실제 ID 가져오기
|
||||
/// </summary>
|
||||
private ulong GetLocalPlayerId()
|
||||
{
|
||||
if (NetworkManager.Singleton == null) return ulong.MaxValue;
|
||||
|
||||
var localPlayer = NetworkManager.Singleton.SpawnManager.GetLocalPlayerObject();
|
||||
if (localPlayer != null)
|
||||
{
|
||||
var playerController = localPlayer.GetComponent<NetworkPlayerController>();
|
||||
if (playerController != null)
|
||||
{
|
||||
return playerController.OwnerPlayerId;
|
||||
}
|
||||
}
|
||||
|
||||
return ulong.MaxValue;
|
||||
}
|
||||
|
||||
private void UpdateVisibility()
|
||||
{
|
||||
var fogSystem = FogOfWarSystem.Instance;
|
||||
@@ -163,7 +189,7 @@ namespace Northbound
|
||||
}
|
||||
|
||||
// Wait for fog data to be initialized
|
||||
var fogData = fogSystem.GetPlayerFogData(_localClientId);
|
||||
var fogData = fogSystem.GetPlayerFogData(_localPlayerId);
|
||||
if (fogData == null)
|
||||
{
|
||||
// Fog data not ready yet - stay hidden
|
||||
@@ -171,7 +197,7 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
FogOfWarState fogState = fogSystem.GetVisibilityState(_localClientId, transform.position);
|
||||
FogOfWarState fogState = fogSystem.GetVisibilityState(_localPlayerId, transform.position);
|
||||
|
||||
// Check for distant visibility based on height
|
||||
bool isDistantVisible = false;
|
||||
|
||||
Reference in New Issue
Block a user