디버깅용 로그 제거
This commit is contained in:
@@ -33,11 +33,9 @@ namespace Northbound
|
||||
NetworkManager.Singleton.ConnectionApprovalCallback = ApprovalCheck;
|
||||
NetworkManager.Singleton.OnServerStarted += OnServerStarted;
|
||||
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
|
||||
Debug.Log("<color=cyan>[Connection] ConnectionApprovalCallback 등록됨</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[Connection] NetworkManager.Singleton이 null입니다!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,13 +54,10 @@ namespace Northbound
|
||||
spawnPoints.Add(point.transform);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"<color=cyan>[Connection] {spawnPoints.Count}개의 스폰 포인트를 찾았습니다.</color>");
|
||||
}
|
||||
|
||||
private void OnServerStarted()
|
||||
{
|
||||
Debug.Log("<color=green>[Connection] 서버 시작됨</color>");
|
||||
|
||||
if (ServerResourceManager.Instance == null)
|
||||
{
|
||||
@@ -76,9 +71,8 @@ namespace Northbound
|
||||
}
|
||||
|
||||
networkObject.Spawn();
|
||||
Debug.Log("[Connection] ServerResourceManager spawned.");
|
||||
}
|
||||
|
||||
|
||||
if (NetworkManager.Singleton.IsHost)
|
||||
{
|
||||
SpawnPlayer(NetworkManager.Singleton.LocalClientId);
|
||||
@@ -90,11 +84,9 @@ namespace Northbound
|
||||
if (!NetworkManager.Singleton.IsServer) return;
|
||||
if (clientId == NetworkManager.Singleton.LocalClientId) return;
|
||||
|
||||
Debug.Log($"<color=cyan>[Connection] 클라이언트 {clientId} 연결됨</color>");
|
||||
|
||||
if (!NetworkManager.Singleton.ConnectedClients.TryGetValue(clientId, out var client) || client.PlayerObject != null)
|
||||
{
|
||||
Debug.Log($"<color=yellow>[Connection] 클라이언트 {clientId}의 플레이어가 이미 존재합니다.</color>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,7 +101,6 @@ namespace Northbound
|
||||
GameObject playerPrefab = NetworkManager.Singleton.NetworkConfig.PlayerPrefab;
|
||||
if (playerPrefab == null)
|
||||
{
|
||||
Debug.LogError("[Connection] PlayerPrefab이 null입니다!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,13 +108,10 @@ namespace Northbound
|
||||
NetworkObject networkObject = playerObject.GetComponent<NetworkObject>();
|
||||
if (networkObject == null)
|
||||
{
|
||||
Debug.LogError("[Connection] PlayerPrefab에 NetworkObject가 없습니다!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
networkObject.SpawnAsPlayerObject(clientId);
|
||||
|
||||
Debug.Log($"<color=green>[Connection] 플레이어 {clientId} 스폰됨: {spawnPosition}</color>");
|
||||
}
|
||||
|
||||
private void ApprovalCheck(
|
||||
@@ -131,27 +119,23 @@ namespace Northbound
|
||||
NetworkManager.ConnectionApprovalResponse response)
|
||||
{
|
||||
spawnPoints.RemoveAll(p => p == null);
|
||||
|
||||
|
||||
if (spawnPoints.Count == 0)
|
||||
{
|
||||
Debug.LogError($"<color=red>[Connection] 스폰 포인트가 없습니다! 씬에 PlayerSpawnPoint가 있는지 확인하세요.</color>");
|
||||
}
|
||||
|
||||
response.Approved = true;
|
||||
response.CreatePlayerObject = false;
|
||||
response.Position = Vector3.zero;
|
||||
response.Rotation = Quaternion.identity;
|
||||
|
||||
Debug.Log($"<color=green>[Connection] 클라이언트 {request.ClientNetworkId} 승인됨. 수동 스폰으로 대기.</color>");
|
||||
}
|
||||
|
||||
private Vector3 GetSpawnPosition(ulong clientId)
|
||||
{
|
||||
spawnPoints.RemoveAll(p => p == null);
|
||||
|
||||
|
||||
if (spawnPoints.Count == 0)
|
||||
{
|
||||
Debug.LogWarning("[Connection] 스폰 포인트가 없습니다. 기본 위치 반환.");
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
@@ -172,12 +156,10 @@ namespace Northbound
|
||||
|
||||
if (spawnIndex >= spawnPoints.Count)
|
||||
{
|
||||
Debug.LogWarning($"<color=yellow>[Connection] 스폰 인덱스 {spawnIndex}가 범위를 벗어났습니다. 기본값으로 조정.</color>");
|
||||
spawnIndex = spawnIndex % spawnPoints.Count;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"<color=yellow>[Connection] 클라이언트 {clientId}에게 스폰 인덱스 {spawnIndex} 할당</color>");
|
||||
return spawnPoints[spawnIndex].position;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user