디버깅용 로그 제거
This commit is contained in:
Binary file not shown.
@@ -41,16 +41,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
_building = GetComponent<Building>();
|
_building = GetComponent<Building>();
|
||||||
_teamMember = GetComponent<ITeamMember>();
|
_teamMember = GetComponent<ITeamMember>();
|
||||||
|
|
||||||
if (_building == null)
|
|
||||||
{
|
|
||||||
Debug.LogError($"<color=red>[AutoTargetSystem] {gameObject.name}에 Building 컴포넌트가 없습니다!</color>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_teamMember == null)
|
|
||||||
{
|
|
||||||
Debug.LogError($"<color=red>[AutoTargetSystem] {gameObject.name}에 ITeamMember 컴포넌트가 없습니다!</color>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@@ -72,10 +62,9 @@ namespace Northbound
|
|||||||
|
|
||||||
// 범위 내 모든 콜라이더 탐지
|
// 범위 내 모든 콜라이더 탐지
|
||||||
Collider[] colliders = Physics.OverlapSphere(transform.position, detectionRange, targetLayer);
|
Collider[] colliders = Physics.OverlapSphere(transform.position, detectionRange, targetLayer);
|
||||||
|
|
||||||
if (showDebugInfo && colliders.Length > 0)
|
if (showDebugInfo && colliders.Length > 0)
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=cyan>[AutoTarget] {gameObject.name}이(가) {colliders.Length}개의 오브젝트를 감지했습니다.</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject closestEnemy = null;
|
GameObject closestEnemy = null;
|
||||||
@@ -100,21 +89,16 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetTeam == null)
|
if (targetTeam == null)
|
||||||
{
|
{
|
||||||
if (showDebugInfo)
|
continue;
|
||||||
{
|
}
|
||||||
Debug.Log($"<color=yellow>[AutoTarget] {col.gameObject.name}에 ITeamMember가 없습니다.</color>");
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 적대 관계 확인
|
// 적대 관계 확인
|
||||||
bool canAttack = TeamManager.CanAttack(_teamMember, targetTeam);
|
bool canAttack = TeamManager.CanAttack(_teamMember, targetTeam);
|
||||||
|
|
||||||
if (showDebugInfo)
|
if (showDebugInfo)
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=yellow>[AutoTarget] {gameObject.name} ({TeamManager.GetTeamName(_teamMember.GetTeam())}) → {col.gameObject.name} ({TeamManager.GetTeamName(targetTeam.GetTeam())}): 공격가능={canAttack}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canAttack)
|
if (!canAttack)
|
||||||
@@ -153,22 +137,14 @@ namespace Northbound
|
|||||||
_lastAttackTime = Time.time;
|
_lastAttackTime = Time.time;
|
||||||
|
|
||||||
// 모든 클라이언트에 빔 효과 표시
|
// 모든 클라이언트에 빔 효과 표시
|
||||||
ShowAttackBeamClientRpc(beamStart, beamEnd);
|
ShowAttackBeamClientRpc(beamStart, beamEnd);
|
||||||
|
|
||||||
var targetTeam = closestEnemy.GetComponent<ITeamMember>() ??
|
|
||||||
closestEnemy.GetComponentInParent<ITeamMember>() ??
|
|
||||||
closestEnemy.GetComponentInChildren<ITeamMember>();
|
|
||||||
|
|
||||||
Debug.Log($"<color=red>[AutoTarget] {gameObject.name} ({TeamManager.GetTeamName(_teamMember.GetTeam())})이(가) {closestEnemy.name} ({TeamManager.GetTeamName(targetTeam?.GetTeam() ?? TeamType.Neutral)})을(를) 공격! (거리: {closestDistance:F2}m, 데미지: {attackDamage})</color>");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"<color=orange>[AutoTarget] {closestEnemy.name}에 IDamageable이 없습니다.</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (showDebugInfo && colliders.Length > 0)
|
else if (showDebugInfo && colliders.Length > 0)
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=yellow>[AutoTarget] {gameObject.name}이(가) 공격 가능한 적을 찾지 못했습니다.</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,15 +200,6 @@ namespace Northbound
|
|||||||
DestroyPreview();
|
DestroyPreview();
|
||||||
ClearDragPreviews();
|
ClearDragPreviews();
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"[BuildingPlacement] 건설 모드 {(isBuildModeActive ? "활성화" : "비활성화")}");
|
|
||||||
Debug.Log($"[BuildingPlacement] Preview object: {(previewObject != null ? "CREATED" : "NULL")}");
|
|
||||||
if (previewObject != null)
|
|
||||||
{
|
|
||||||
Debug.Log($"[BuildingPlacement] Preview position: {previewObject.transform.position}");
|
|
||||||
Debug.Log($"[BuildingPlacement] Preview scale: {previewObject.transform.localScale}");
|
|
||||||
Debug.Log($"[BuildingPlacement] Preview active: {previewObject.activeSelf}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -240,7 +231,6 @@ namespace Northbound
|
|||||||
CreatePreview();
|
CreatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"[BuildingPlacement] 건물 선택됨: {BuildingManager.Instance.availableBuildings[index].buildingName}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePreview()
|
private void CreatePreview()
|
||||||
@@ -251,10 +241,6 @@ namespace Northbound
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[BuildingPlacement] Creating preview...</color>");
|
|
||||||
Debug.Log($"<color=cyan>[BuildingPlacement] BuildingManager.availableBuildings.Count: {BuildingManager.Instance.availableBuildings.Count}</color>");
|
|
||||||
Debug.Log($"<color=cyan>[BuildingPlacement] selectedBuildingIndex: {selectedBuildingIndex}</color>");
|
|
||||||
|
|
||||||
if (selectedBuildingIndex < 0 || selectedBuildingIndex >= BuildingManager.Instance.availableBuildings.Count)
|
if (selectedBuildingIndex < 0 || selectedBuildingIndex >= BuildingManager.Instance.availableBuildings.Count)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[BuildingPlacement] 유효하지 않은 건물 인덱스: {selectedBuildingIndex}");
|
Debug.LogWarning($"[BuildingPlacement] 유효하지 않은 건물 인덱스: {selectedBuildingIndex}");
|
||||||
@@ -274,9 +260,6 @@ namespace Northbound
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=green>[BuildingPlacement] TowerData: {data.buildingName}, Prefab: {data.prefab.name}</color>");
|
|
||||||
Debug.Log($"<color=green>[BuildingPlacement] Prefab scale: {data.prefab.transform.localScale}</color>");
|
|
||||||
|
|
||||||
// 완성 건물 프리팹으로 프리뷰 생성 (사용자가 완성 모습을 볼 수 있도록)
|
// 완성 건물 프리팹으로 프리뷰 생성 (사용자가 완성 모습을 볼 수 있도록)
|
||||||
previewObject = Instantiate(data.prefab);
|
previewObject = Instantiate(data.prefab);
|
||||||
|
|
||||||
@@ -318,7 +301,6 @@ namespace Northbound
|
|||||||
obstacle.enabled = false;
|
obstacle.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"[BuildingPlacement] 프리뷰 생성됨: {data.buildingName}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DestroyPreview()
|
private void DestroyPreview()
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (creepPrefabs.Count == 0)
|
if (creepPrefabs.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[CreepCamp] No creep prefabs assigned!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,14 +90,12 @@ namespace Northbound
|
|||||||
GameObject selectedCreep = SelectCreepByCost(remainingCost);
|
GameObject selectedCreep = SelectCreepByCost(remainingCost);
|
||||||
if (selectedCreep == null)
|
if (selectedCreep == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[CreepCamp] No affordable creeps. Remaining cost: {remainingCost:F2}");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreepData creepData = GetCreepDataFromPrefab(selectedCreep);
|
CreepData creepData = GetCreepDataFromPrefab(selectedCreep);
|
||||||
if (creepData == null)
|
if (creepData == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[CreepCamp] Could not get creep data from {selectedCreep.name}");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +103,6 @@ namespace Northbound
|
|||||||
remainingCost -= creepData.cost;
|
remainingCost -= creepData.cost;
|
||||||
spawnedCount++;
|
spawnedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=green>[CreepCamp] Spawned {spawnedCount} creeps (Cost budget: {_campCostBudget * _campStrength:F2}, Used: {(_campCostBudget * _campStrength) - remainingCost:F2})</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GameObject SelectCreepByCost(float remainingCost)
|
private GameObject SelectCreepByCost(float remainingCost)
|
||||||
@@ -179,7 +174,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (resourcePickupPrefab == null)
|
if (resourcePickupPrefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[CreepCamp] No resource pickup prefab assigned!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +182,6 @@ namespace Northbound
|
|||||||
_resourcePickup = pickup.GetComponent<ResourcePickup>();
|
_resourcePickup = pickup.GetComponent<ResourcePickup>();
|
||||||
if (_resourcePickup == null)
|
if (_resourcePickup == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"[CreepCamp] ResourcePickup component not found on prefab!");
|
|
||||||
Destroy(pickup);
|
Destroy(pickup);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -207,8 +200,6 @@ namespace Northbound
|
|||||||
|
|
||||||
// 비활성화는 ServerRpc를 통해 처리
|
// 비활성화는 ServerRpc를 통해 처리
|
||||||
DisablePickupClientRpc();
|
DisablePickupClientRpc();
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[CreepCamp] Resource pickup spawned (Amount: {_resourcePickup.resourceAmount})</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleCreepDeath(EnemyUnit deadCreep)
|
private void HandleCreepDeath(EnemyUnit deadCreep)
|
||||||
@@ -226,13 +217,10 @@ namespace Northbound
|
|||||||
// 리스트에서 해당 creep 제거
|
// 리스트에서 해당 creep 제거
|
||||||
_spawnedCreeps.Remove(deadCreep);
|
_spawnedCreeps.Remove(deadCreep);
|
||||||
|
|
||||||
Debug.Log($"<color=orange>[CreepCamp] Creep died. Remaining creeps: {_spawnedCreeps.Count}</color>");
|
|
||||||
|
|
||||||
// 모든 creep이 처치되었으면 ResourcePickup 활성화
|
// 모든 creep이 처치되었으면 ResourcePickup 활성화
|
||||||
if (_spawnedCreeps.Count == 0 && _resourcePickup != null)
|
if (_spawnedCreeps.Count == 0 && _resourcePickup != null)
|
||||||
{
|
{
|
||||||
EnableResourcePickupClientRpc();
|
EnableResourcePickupClientRpc();
|
||||||
Debug.Log($"<color=green>[CreepCamp] All creeps defeated! Resource pickup enabled.</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,10 +285,6 @@ namespace Northbound
|
|||||||
_deathHandlers[enemyUnit] = handler;
|
_deathHandlers[enemyUnit] = handler;
|
||||||
enemyUnit.OnDeath += handler;
|
enemyUnit.OnDeath += handler;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[CreepCamp] EnemyUnit component not found on creep prefab {prefab.name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
networkObj.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
|
networkObj.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (creepData == null)
|
if (creepData == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[CreepDataComponent] creepData is null", this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,16 +101,15 @@ namespace Northbound
|
|||||||
_agent.acceleration = 8f;
|
_agent.acceleration = 8f;
|
||||||
_agent.angularSpeed = 120f;
|
_agent.angularSpeed = 120f;
|
||||||
_agent.stoppingDistance = attackRange * 0.7f;
|
_agent.stoppingDistance = attackRange * 0.7f;
|
||||||
_agent.autoBraking = true;
|
_agent.autoBraking = true;
|
||||||
_agent.updateRotation = true;
|
_agent.updateRotation = true;
|
||||||
_agent.updateUpAxis = false;
|
_agent.updateUpAxis = false;
|
||||||
|
|
||||||
if (!_agent.isOnNavMesh)
|
if (!_agent.isOnNavMesh)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"<color=orange>[EnemyAI] {gameObject.name}이(가) NavMesh 위에 있지 않습니다!</color>");
|
}
|
||||||
}
|
|
||||||
|
if (aiType == TeamType.Monster)
|
||||||
if (aiType == TeamType.Monster)
|
|
||||||
{
|
{
|
||||||
FindCore();
|
FindCore();
|
||||||
TransitionToState(EnemyAIState.MoveToCore);
|
TransitionToState(EnemyAIState.MoveToCore);
|
||||||
@@ -248,7 +247,7 @@ namespace Northbound
|
|||||||
GameObject target = GetTargetPlayer();
|
GameObject target = GetTargetPlayer();
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
if (showDebugInfo) Debug.Log("<color=red>[EnemyAI] 타겟 상실 - 상태 해제</color>");
|
if (showDebugInfo) {}
|
||||||
OnLostTarget();
|
OnLostTarget();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -417,19 +416,11 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
damageable.TakeDamage(attackDamage, NetworkObjectId);
|
damageable.TakeDamage(attackDamage, NetworkObjectId);
|
||||||
_lastAttackTime = Time.time;
|
_lastAttackTime = Time.time;
|
||||||
|
|
||||||
OnAttackPerformed?.Invoke(target);
|
OnAttackPerformed?.Invoke(target);
|
||||||
|
|
||||||
if (showDebugInfo)
|
|
||||||
Debug.Log($"<color=red>[EnemyAI] {gameObject.name} -> {target.name} 타격 성공! (데미지: {attackDamage})</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 3. 만약 IDamageable을 못 찾았다면 로그를 남겨서 범인을 찾습니다.
|
|
||||||
if (showDebugInfo)
|
|
||||||
Debug.LogWarning($"<color=yellow>[EnemyAI] {target.name}에 IDamageable 스크립트가 없습니다!</color>");
|
|
||||||
|
|
||||||
// 공격할 수 없는 대상이면 상태를 해제합니다.
|
// 공격할 수 없는 대상이면 상태를 해제합니다.
|
||||||
OnLostTarget();
|
OnLostTarget();
|
||||||
}
|
}
|
||||||
@@ -504,9 +495,9 @@ namespace Northbound
|
|||||||
// 사망 상태로 전환
|
// 사망 상태로 전환
|
||||||
TransitionToState(EnemyAIState.Dead);
|
TransitionToState(EnemyAIState.Dead);
|
||||||
ClearTargetPlayer();
|
ClearTargetPlayer();
|
||||||
|
|
||||||
if (showDebugInfo)
|
if (showDebugInfo)
|
||||||
Debug.Log($"<color=red>[EnemyAI] {gameObject.name}이(가) 사망했습니다. (killer: {killerId})</color>");
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLostTarget()
|
private void OnLostTarget()
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ using UnityEngine;
|
|||||||
{
|
{
|
||||||
_team.Value = portalTeam;
|
_team.Value = portalTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[EnemyPortal] 포털 스폰됨 (팀: {TeamManager.GetTeamName(_team.Value)}, 체력: {_currentHealth.Value}/{maxHealth})</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalTimer.Instance.OnCycleStart += OnCycleStart;
|
GlobalTimer.Instance.OnCycleStart += OnCycleStart;
|
||||||
@@ -104,7 +102,6 @@ using UnityEngine;
|
|||||||
|
|
||||||
if (monsterData == null)
|
if (monsterData == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[EnemyPortal] Could not find MonsterData on {selectedEntry.prefab.name}");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,11 +118,6 @@ using UnityEngine;
|
|||||||
remainingCost -= monsterData.cost;
|
remainingCost -= monsterData.cost;
|
||||||
spawnedCount++;
|
spawnedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spawnedCount > 0)
|
|
||||||
{
|
|
||||||
Debug.Log($"[EnemyPortal] Spawned {spawnedCount} monsters (Cost used: {currentCost - remainingCost:F2})");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanSpawnAnyMonster(float remainingCost)
|
private bool CanSpawnAnyMonster(float remainingCost)
|
||||||
@@ -200,8 +192,6 @@ using UnityEngine;
|
|||||||
|
|
||||||
var netObj = enemy.GetComponent<NetworkObject>();
|
var netObj = enemy.GetComponent<NetworkObject>();
|
||||||
netObj.Spawn(true);
|
netObj.Spawn(true);
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[EnemyPortal] {enemy.name} 스폰됨 - OwnerClientId: {netObj.OwnerClientId}, IsServer: {IsServer}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IncreaseCost()
|
private void IncreaseCost()
|
||||||
@@ -238,7 +228,6 @@ using UnityEngine;
|
|||||||
{
|
{
|
||||||
if (!TeamManager.CanAttack(attackerTeamMember, this))
|
if (!TeamManager.CanAttack(attackerTeamMember, this))
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=yellow>[EnemyPortal] {TeamManager.GetTeamName(attackerTeamMember.GetTeam())} 팀은 {TeamManager.GetTeamName(_team.Value)} 팀 포털을 공격할 수 없습니다.</color>");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,8 +237,6 @@ using UnityEngine;
|
|||||||
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
||||||
_currentHealth.Value -= actualDamage;
|
_currentHealth.Value -= actualDamage;
|
||||||
|
|
||||||
Debug.Log($"<color=red>[EnemyPortal] 포털이 {actualDamage} 데미지를 받았습니다. 남은 체력: {_currentHealth.Value}/{maxHealth}</color>");
|
|
||||||
|
|
||||||
// 데미지 이펙트
|
// 데미지 이펙트
|
||||||
ShowDamageEffectClientRpc();
|
ShowDamageEffectClientRpc();
|
||||||
|
|
||||||
@@ -264,8 +251,6 @@ using UnityEngine;
|
|||||||
{
|
{
|
||||||
if (!IsServer) return;
|
if (!IsServer) return;
|
||||||
|
|
||||||
Debug.Log($"<color=red>[EnemyPortal] 포털이 파괴되었습니다! (공격자: {attackerId})</color>");
|
|
||||||
|
|
||||||
// 파괴 이펙트
|
// 파괴 이펙트
|
||||||
ShowDestroyEffectClientRpc();
|
ShowDestroyEffectClientRpc();
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,7 @@ namespace Northbound
|
|||||||
|
|
||||||
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
||||||
_currentHealth.Value -= actualDamage;
|
_currentHealth.Value -= actualDamage;
|
||||||
|
|
||||||
Debug.Log($"<color=red>[EnemyUnit] 적 유닛이 {actualDamage} 데미지를 받았습니다. 남은 체력: {_currentHealth.Value}/{maxHealth}</color>");
|
|
||||||
|
|
||||||
// 데미지 이펙트
|
// 데미지 이펙트
|
||||||
ShowDamageEffectClientRpc();
|
ShowDamageEffectClientRpc();
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ namespace Northbound
|
|||||||
// NetworkManager 준비 대기
|
// NetworkManager 준비 대기
|
||||||
if (NetworkManager.Singleton == null || !NetworkManager.Singleton.IsClient)
|
if (NetworkManager.Singleton == null || !NetworkManager.Singleton.IsClient)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[FogOfWar] NetworkManager가 준비되지 않았습니다. 대기 중...");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +54,6 @@ namespace Northbound
|
|||||||
var fogSystem = FogOfWarSystem.Instance;
|
var fogSystem = FogOfWarSystem.Instance;
|
||||||
if (fogSystem == null)
|
if (fogSystem == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[FogOfWar] FogOfWarSystem을 찾을 수 없습니다! 씬에 FogOfWarSystem GameObject가 있는지 확인하세요.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +82,6 @@ namespace Northbound
|
|||||||
instanceMaterial.mainTexture = _fogTexture;
|
instanceMaterial.mainTexture = _fogTexture;
|
||||||
_meshRenderer.material = instanceMaterial;
|
_meshRenderer.material = instanceMaterial;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("[FogOfWar] Fog Material이 설정되지 않았습니다!");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (fogSystem.disableInEditor)
|
if (fogSystem.disableInEditor)
|
||||||
@@ -98,12 +92,11 @@ namespace Northbound
|
|||||||
|
|
||||||
// 렌더링 레이어 설정
|
// 렌더링 레이어 설정
|
||||||
gameObject.layer = LayerMask.NameToLayer("UI"); // 또는 별도 레이어 생성
|
gameObject.layer = LayerMask.NameToLayer("UI"); // 또는 별도 레이어 생성
|
||||||
|
|
||||||
// 메쉬 생성
|
// 메쉬 생성
|
||||||
CreatePlaneMesh(fogSystem);
|
CreatePlaneMesh(fogSystem);
|
||||||
|
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
Debug.Log($"<color=cyan>[FogOfWar] 렌더러 초기화 완료 (Client {_localClientId})</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@@ -255,8 +248,6 @@ namespace Northbound
|
|||||||
|
|
||||||
meshFilter.mesh = mesh;
|
meshFilter.mesh = mesh;
|
||||||
transform.position = fogSystem.worldOrigin;
|
transform.position = fogSystem.worldOrigin;
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[FogOfWar] Plane Mesh 생성 완료: {width}x{height} at {fogSystem.worldOrigin}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
|
|||||||
@@ -256,19 +256,17 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
// 클라이언트는 로컬 데이터 초기화
|
// 클라이언트는 로컬 데이터 초기화
|
||||||
_localFogData = new FogOfWarData(gridWidth, gridHeight);
|
_localFogData = new FogOfWarData(gridWidth, gridHeight);
|
||||||
Debug.Log($"<color=cyan>[FogOfWar] 클라이언트 {NetworkManager.LocalClientId} 초기화</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientConnected(ulong clientId)
|
private void OnClientConnected(ulong clientId)
|
||||||
{
|
{
|
||||||
if (!IsServer) return;
|
if (!IsServer) return;
|
||||||
|
|
||||||
// Ensure fog data exists for this client
|
// Ensure fog data exists for this client
|
||||||
if (!_serverFogData.ContainsKey(clientId))
|
if (!_serverFogData.ContainsKey(clientId))
|
||||||
{
|
{
|
||||||
_serverFogData[clientId] = new FogOfWarData(gridWidth, gridHeight);
|
_serverFogData[clientId] = new FogOfWarData(gridWidth, gridHeight);
|
||||||
Debug.Log($"<color=cyan>[FogOfWar] 클라이언트 {clientId} 안개 데이터 초기화</color>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Northbound
|
|||||||
|
|
||||||
if (renderers == null || renderers.Length == 0)
|
if (renderers == null || renderers.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[FogOfWarVisibility] {gameObject.name}: No renderers found! Component will not work.");
|
// Debug.LogWarning($"[FogOfWarVisibility] {gameObject.name}: No renderers found! Component will not work.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,9 +104,6 @@ namespace Northbound
|
|||||||
_hasReachedHalfway = true;
|
_hasReachedHalfway = true;
|
||||||
OnHalfwayPoint?.Invoke(cycleLength / 2f);
|
OnHalfwayPoint?.Invoke(cycleLength / 2f);
|
||||||
NotifyHalfwayClientRpc();
|
NotifyHalfwayClientRpc();
|
||||||
|
|
||||||
if (showDebugLogs)
|
|
||||||
Debug.Log($"<color=yellow>[GlobalTimer] 사이클 중간 지점 도달</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 사이클 완료
|
// 사이클 완료
|
||||||
@@ -136,14 +133,11 @@ namespace Northbound
|
|||||||
// 다음 사이클 시작
|
// 다음 사이클 시작
|
||||||
_currentTime.Value = cycleLength;
|
_currentTime.Value = cycleLength;
|
||||||
_cycleCount.Value++;
|
_cycleCount.Value++;
|
||||||
_hasReachedHalfway = false;
|
_hasReachedHalfway = false;
|
||||||
|
|
||||||
OnCycleStart?.Invoke(_cycleCount.Value);
|
OnCycleStart?.Invoke(_cycleCount.Value);
|
||||||
NotifyCycleStartClientRpc(_cycleCount.Value);
|
NotifyCycleStartClientRpc(_cycleCount.Value);
|
||||||
|
}
|
||||||
if (showDebugLogs)
|
|
||||||
Debug.Log($"<color=cyan>[GlobalTimer] 사이클 {_cycleCount.Value} 시작</color>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCurrentTimeChanged(float previousValue, float newValue)
|
private void OnCurrentTimeChanged(float previousValue, float newValue)
|
||||||
@@ -171,9 +165,6 @@ namespace Northbound
|
|||||||
|
|
||||||
OnCycleStart?.Invoke(_cycleCount.Value);
|
OnCycleStart?.Invoke(_cycleCount.Value);
|
||||||
NotifyCycleStartClientRpc(_cycleCount.Value);
|
NotifyCycleStartClientRpc(_cycleCount.Value);
|
||||||
|
|
||||||
if (showDebugLogs)
|
|
||||||
Debug.Log($"<color=green>[GlobalTimer] 타이머 시작: {cycleLength}초</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -17,12 +17,9 @@ namespace Northbound
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] Awake called on {gameObject.name}");
|
|
||||||
|
|
||||||
if (playerInteraction == null)
|
if (playerInteraction == null)
|
||||||
{
|
{
|
||||||
playerInteraction = GetComponent<PlayerInteraction>();
|
playerInteraction = GetComponent<PlayerInteraction>();
|
||||||
Debug.Log($"[InteractableModalManager] PlayerInteraction: {(playerInteraction != null ? "Found" : "Not Found")}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FindModalComponent();
|
FindModalComponent();
|
||||||
@@ -30,15 +27,8 @@ namespace Northbound
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] Start called on {gameObject.name}");
|
|
||||||
|
|
||||||
FindModalComponent();
|
FindModalComponent();
|
||||||
|
|
||||||
if (interactableModal == null)
|
|
||||||
{
|
|
||||||
Debug.LogError("[InteractableModalManager] InteractableModal is still null in Start!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start()에서 HideModal()을 호출하지 않음 - 첫 번째 Update에서 Modal이 표시되지 않는 문제 방지
|
// Start()에서 HideModal()을 호출하지 않음 - 첫 번째 Update에서 Modal이 표시되지 않는 문제 방지
|
||||||
// modalPanel과 unavailablePanel은 InteractableModal.Start()에서 이미 false로 설정됨
|
// modalPanel과 unavailablePanel은 InteractableModal.Start()에서 이미 false로 설정됨
|
||||||
}
|
}
|
||||||
@@ -47,21 +37,14 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (interactableModal != null)
|
if (interactableModal != null)
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] InteractableModal already assigned: {interactableModal.gameObject.name}");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InteractableModal[] modals = GetComponentsInChildren<InteractableModal>(true);
|
InteractableModal[] modals = GetComponentsInChildren<InteractableModal>(true);
|
||||||
Debug.Log($"[InteractableModalManager] Found {modals.Length} InteractableModal components in player children");
|
|
||||||
|
|
||||||
if (modals.Length > 0)
|
if (modals.Length > 0)
|
||||||
{
|
{
|
||||||
interactableModal = modals[0];
|
interactableModal = modals[0];
|
||||||
Debug.Log($"[InteractableModalManager] Using InteractableModal on: {interactableModal.gameObject.name}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("[InteractableModalManager] InteractableModal not found in player children!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +52,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (playerInteraction == null)
|
if (playerInteraction == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[InteractableModalManager] Update: playerInteraction is null");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,17 +82,14 @@ namespace Northbound
|
|||||||
|
|
||||||
if (_currentInteractable != null)
|
if (_currentInteractable != null)
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] Show modal for interactable");
|
|
||||||
ShowModal(_currentInteractable);
|
ShowModal(_currentInteractable);
|
||||||
}
|
}
|
||||||
else if (unavailableInteractable != null)
|
else if (unavailableInteractable != null)
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] Show unavailable message");
|
|
||||||
ShowUnavailableMessageModal(unavailableInteractable);
|
ShowUnavailableMessageModal(unavailableInteractable);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Log($"[InteractableModalManager] Hide modal");
|
|
||||||
HideModal();
|
HideModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MapGenerator] Core not found in scene!");
|
|
||||||
_corePosition = Vector2.zero;
|
_corePosition = Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +177,6 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MapGenerator] No Resource found in scene!");
|
|
||||||
_initialResourcePosition = Vector2.zero;
|
_initialResourcePosition = Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +187,6 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MapGenerator] Worker Hall not found in scene!");
|
|
||||||
_barracksPosition = Vector2.zero;
|
_barracksPosition = Vector2.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +216,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (resourcePrefab == null)
|
if (resourcePrefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[MapGenerator] Resource prefab not assigned!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,20 +227,13 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
_generatedResources = resources;
|
_generatedResources = resources;
|
||||||
success = true;
|
success = true;
|
||||||
Debug.Log($"<color=green>[MapGenerator] Normal resource generation succeeded on attempt {attempt + 1}</color>");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[MapGenerator] Resource generation attempt {attempt + 1} failed validation");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("<color=yellow>[MapGenerator] All resource generation attempts failed, using fallback layout</color>");
|
|
||||||
GenerateResourceFallbackLayout();
|
GenerateResourceFallbackLayout();
|
||||||
Debug.Log($"<color=yellow>[MapGenerator] Fallback layout X coordinates: {string.Join(", ", System.Array.ConvertAll(_generatedResources, r => r.position.x.ToString("F1")))}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnResources();
|
SpawnResources();
|
||||||
@@ -309,7 +298,6 @@ namespace Northbound
|
|||||||
if (IsValidResourcePosition(candidatePosition, existingResources, currentIndex))
|
if (IsValidResourcePosition(candidatePosition, existingResources, currentIndex))
|
||||||
{
|
{
|
||||||
position = candidatePosition;
|
position = candidatePosition;
|
||||||
Debug.Log($"[MapGenerator] Generated valid resource position: X={position.x:F2} (range: {-playableAreaWidth/2f:F2} to {playableAreaWidth/2f:F2})");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,7 +402,6 @@ namespace Northbound
|
|||||||
Resource resource = resourceObj.GetComponent<Resource>();
|
Resource resource = resourceObj.GetComponent<Resource>();
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"[MapGenerator] Resource prefab at index {i} doesn't have Resource component!");
|
|
||||||
Destroy(resourceObj);
|
Destroy(resourceObj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -428,7 +415,6 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError($"[MapGenerator] Resource prefab at index {i} doesn't have NetworkObject component!");
|
|
||||||
Destroy(resourceObj);
|
Destroy(resourceObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +442,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (obstacle.prefab == null)
|
if (obstacle.prefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[MapGenerator] Obstacle prefab is null!");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,7 +642,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (creepCampPrefab == null)
|
if (creepCampPrefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MapGenerator] Creep camp prefab not assigned, skipping creep camp generation.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,7 +649,6 @@ namespace Northbound
|
|||||||
|
|
||||||
if (_creepPrefabs.Count == 0)
|
if (_creepPrefabs.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MapGenerator] No creep prefabs found in Assets/Prefabs/Creep/, skipping creep camp generation.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,13 +704,8 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Debug.LogWarning("[MapGenerator] Creep prefabs not loaded in build. Please assign creep prefabs manually in Inspector.");
|
// Creep prefabs not available in build - please assign manually
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_creepPrefabs.Count == 0)
|
|
||||||
{
|
|
||||||
Debug.LogWarning("[MapGenerator] No creep prefabs loaded!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 FindValidCampPosition()
|
private Vector3 FindValidCampPosition()
|
||||||
@@ -791,8 +769,6 @@ namespace Northbound
|
|||||||
float bestDistance = float.MaxValue;
|
float bestDistance = float.MaxValue;
|
||||||
int maxAttempts = 50;
|
int maxAttempts = 50;
|
||||||
|
|
||||||
Debug.Log($"[MapGenerator] FindValidCampPositionForResource: Resource at {resourcePosition}, bounds: X:[{-playableAreaWidth/2f}, {playableAreaWidth/2f}], Z:[{startZ}, {endZ}]");
|
|
||||||
|
|
||||||
for (int attempt = 0; attempt < maxAttempts; attempt++)
|
for (int attempt = 0; attempt < maxAttempts; attempt++)
|
||||||
{
|
{
|
||||||
float angle = Random.Range(0f, 360f);
|
float angle = Random.Range(0f, 360f);
|
||||||
@@ -813,11 +789,6 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bestPosition == Vector3.zero)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[MapGenerator] Failed to find camp position for resource at {resourcePosition} after {maxAttempts} attempts");
|
|
||||||
}
|
|
||||||
|
|
||||||
return bestPosition;
|
return bestPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,7 +826,6 @@ namespace Northbound
|
|||||||
|
|
||||||
creepCamp.InitializeCamp(position.z, strength, campCostBudget, spawnRadius, maxSpawnAttempts);
|
creepCamp.InitializeCamp(position.z, strength, campCostBudget, spawnRadius, maxSpawnAttempts);
|
||||||
creepCamp.SetCreepPrefabs(_creepPrefabs);
|
creepCamp.SetCreepPrefabs(_creepPrefabs);
|
||||||
Debug.Log($"[MapGenerator] Camp initialized with {_creepPrefabs.Count} creep prefabs");
|
|
||||||
|
|
||||||
NetworkObject networkObj = campObj.GetComponent<NetworkObject>();
|
NetworkObject networkObj = campObj.GetComponent<NetworkObject>();
|
||||||
if (networkObj == null)
|
if (networkObj == null)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (monsterData == null)
|
if (monsterData == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[MonsterDataComponent] monsterData is null", this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,8 +54,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
navAgent.speed = monsterData.moveSpeed;
|
navAgent.speed = monsterData.moveSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"[MonsterDataComponent] Applied data for {monsterData.id} ({monsterData.memo})", this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,5 @@ namespace Northbound
|
|||||||
|
|
||||||
Debug.Log("================================");
|
Debug.Log("================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
Invoke(nameof(LogNetworkConfig), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ namespace Northbound
|
|||||||
NetworkManager.Singleton.ConnectionApprovalCallback = ApprovalCheck;
|
NetworkManager.Singleton.ConnectionApprovalCallback = ApprovalCheck;
|
||||||
NetworkManager.Singleton.OnServerStarted += OnServerStarted;
|
NetworkManager.Singleton.OnServerStarted += OnServerStarted;
|
||||||
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
|
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
|
||||||
Debug.Log("<color=cyan>[Connection] ConnectionApprovalCallback 등록됨</color>");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError("[Connection] NetworkManager.Singleton이 null입니다!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,13 +54,10 @@ namespace Northbound
|
|||||||
spawnPoints.Add(point.transform);
|
spawnPoints.Add(point.transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[Connection] {spawnPoints.Count}개의 스폰 포인트를 찾았습니다.</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnServerStarted()
|
private void OnServerStarted()
|
||||||
{
|
{
|
||||||
Debug.Log("<color=green>[Connection] 서버 시작됨</color>");
|
|
||||||
|
|
||||||
if (ServerResourceManager.Instance == null)
|
if (ServerResourceManager.Instance == null)
|
||||||
{
|
{
|
||||||
@@ -76,9 +71,8 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
|
|
||||||
networkObject.Spawn();
|
networkObject.Spawn();
|
||||||
Debug.Log("[Connection] ServerResourceManager spawned.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NetworkManager.Singleton.IsHost)
|
if (NetworkManager.Singleton.IsHost)
|
||||||
{
|
{
|
||||||
SpawnPlayer(NetworkManager.Singleton.LocalClientId);
|
SpawnPlayer(NetworkManager.Singleton.LocalClientId);
|
||||||
@@ -90,11 +84,9 @@ namespace Northbound
|
|||||||
if (!NetworkManager.Singleton.IsServer) return;
|
if (!NetworkManager.Singleton.IsServer) return;
|
||||||
if (clientId == NetworkManager.Singleton.LocalClientId) 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)
|
if (!NetworkManager.Singleton.ConnectedClients.TryGetValue(clientId, out var client) || client.PlayerObject != null)
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=yellow>[Connection] 클라이언트 {clientId}의 플레이어가 이미 존재합니다.</color>");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +101,6 @@ namespace Northbound
|
|||||||
GameObject playerPrefab = NetworkManager.Singleton.NetworkConfig.PlayerPrefab;
|
GameObject playerPrefab = NetworkManager.Singleton.NetworkConfig.PlayerPrefab;
|
||||||
if (playerPrefab == null)
|
if (playerPrefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[Connection] PlayerPrefab이 null입니다!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,13 +108,10 @@ namespace Northbound
|
|||||||
NetworkObject networkObject = playerObject.GetComponent<NetworkObject>();
|
NetworkObject networkObject = playerObject.GetComponent<NetworkObject>();
|
||||||
if (networkObject == null)
|
if (networkObject == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[Connection] PlayerPrefab에 NetworkObject가 없습니다!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
networkObject.SpawnAsPlayerObject(clientId);
|
networkObject.SpawnAsPlayerObject(clientId);
|
||||||
|
|
||||||
Debug.Log($"<color=green>[Connection] 플레이어 {clientId} 스폰됨: {spawnPosition}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApprovalCheck(
|
private void ApprovalCheck(
|
||||||
@@ -131,27 +119,23 @@ namespace Northbound
|
|||||||
NetworkManager.ConnectionApprovalResponse response)
|
NetworkManager.ConnectionApprovalResponse response)
|
||||||
{
|
{
|
||||||
spawnPoints.RemoveAll(p => p == null);
|
spawnPoints.RemoveAll(p => p == null);
|
||||||
|
|
||||||
if (spawnPoints.Count == 0)
|
if (spawnPoints.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogError($"<color=red>[Connection] 스폰 포인트가 없습니다! 씬에 PlayerSpawnPoint가 있는지 확인하세요.</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Approved = true;
|
response.Approved = true;
|
||||||
response.CreatePlayerObject = false;
|
response.CreatePlayerObject = false;
|
||||||
response.Position = Vector3.zero;
|
response.Position = Vector3.zero;
|
||||||
response.Rotation = Quaternion.identity;
|
response.Rotation = Quaternion.identity;
|
||||||
|
|
||||||
Debug.Log($"<color=green>[Connection] 클라이언트 {request.ClientNetworkId} 승인됨. 수동 스폰으로 대기.</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetSpawnPosition(ulong clientId)
|
private Vector3 GetSpawnPosition(ulong clientId)
|
||||||
{
|
{
|
||||||
spawnPoints.RemoveAll(p => p == null);
|
spawnPoints.RemoveAll(p => p == null);
|
||||||
|
|
||||||
if (spawnPoints.Count == 0)
|
if (spawnPoints.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[Connection] 스폰 포인트가 없습니다. 기본 위치 반환.");
|
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,12 +156,10 @@ namespace Northbound
|
|||||||
|
|
||||||
if (spawnIndex >= spawnPoints.Count)
|
if (spawnIndex >= spawnPoints.Count)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"<color=yellow>[Connection] 스폰 인덱스 {spawnIndex}가 범위를 벗어났습니다. 기본값으로 조정.</color>");
|
|
||||||
spawnIndex = spawnIndex % spawnPoints.Count;
|
spawnIndex = spawnIndex % spawnPoints.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=yellow>[Connection] 클라이언트 {clientId}에게 스폰 인덱스 {spawnIndex} 할당</color>");
|
|
||||||
return spawnPoints[spawnIndex].position;
|
return spawnPoints[spawnIndex].position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ namespace Northbound
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigureTransport("0.0.0.0", port);
|
ConfigureTransport("0.0.0.0", port);
|
||||||
|
|
||||||
if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsClient)
|
if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsClient)
|
||||||
{
|
{
|
||||||
NetworkManager.Singleton.StartHost();
|
NetworkManager.Singleton.StartHost();
|
||||||
Debug.Log($"[NetworkConnectionHelper] Started Host on port {port}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
{
|
{
|
||||||
_currentHealth.Value = maxHealth;
|
_currentHealth.Value = maxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"<color=cyan>[Player] {gameObject.name} 스폰됨 (팀: {TeamManager.GetTeamName(_team.Value)}, 체력: {_currentHealth.Value}/{maxHealth})</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 체력 변경 이벤트 구독
|
// 체력 변경 이벤트 구독
|
||||||
@@ -69,14 +67,13 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
|
|
||||||
if (!IsOwner) return;
|
if (!IsOwner) return;
|
||||||
|
|
||||||
var vcam = GameObject.FindFirstObjectByType<CinemachineCamera>();
|
var vcam = GameObject.FindFirstObjectByType<CinemachineCamera>();
|
||||||
|
|
||||||
if (vcam != null)
|
if (vcam != null)
|
||||||
{
|
{
|
||||||
vcam.Follow = transform;
|
vcam.Follow = transform;
|
||||||
vcam.LookAt = transform;
|
vcam.LookAt = transform;
|
||||||
Debug.Log("<color=green>[Camera] 로컬 플레이어에게 카메라가 연결되었습니다.</color>");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_inputActions = new PlayerInputActions();
|
_inputActions = new PlayerInputActions();
|
||||||
_inputActions.Enable();
|
_inputActions.Enable();
|
||||||
@@ -148,7 +145,6 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
|
|
||||||
TeamType previousTeam = _team.Value;
|
TeamType previousTeam = _team.Value;
|
||||||
_team.Value = team;
|
_team.Value = team;
|
||||||
Debug.Log($"<color=cyan>[Player] 팀 변경: {TeamManager.GetTeamName(previousTeam)} → {TeamManager.GetTeamName(team)}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -170,7 +166,6 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
{
|
{
|
||||||
if (!TeamManager.CanAttack(attackerTeamMember, this))
|
if (!TeamManager.CanAttack(attackerTeamMember, this))
|
||||||
{
|
{
|
||||||
Debug.Log($"<color=yellow>[Player] {TeamManager.GetTeamName(attackerTeamMember.GetTeam())} 팀은 {TeamManager.GetTeamName(_team.Value)} 팀을 공격할 수 없습니다.</color>");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,8 +175,6 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
||||||
_currentHealth.Value -= actualDamage;
|
_currentHealth.Value -= actualDamage;
|
||||||
|
|
||||||
Debug.Log($"<color=red>[Player] {gameObject.name} ({TeamManager.GetTeamName(_team.Value)})이(가) {actualDamage} 데미지를 받았습니다. 남은 체력: {_currentHealth.Value}/{maxHealth}</color>");
|
|
||||||
|
|
||||||
// 데미지 이펙트
|
// 데미지 이펙트
|
||||||
ShowDamageEffectClientRpc();
|
ShowDamageEffectClientRpc();
|
||||||
|
|
||||||
@@ -192,13 +185,11 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Die(ulong killerId)
|
private void Die(ulong killerId)
|
||||||
{
|
{
|
||||||
if (!IsServer) return;
|
if (!IsServer) return;
|
||||||
|
|
||||||
Debug.Log($"<color=red>[Player] {gameObject.name} ({TeamManager.GetTeamName(_team.Value)})이(가) 사망했습니다! (킬러: {killerId})</color>");
|
// 사망 이펙트
|
||||||
|
|
||||||
// 사망 이펙트
|
|
||||||
ShowDeathEffectClientRpc();
|
ShowDeathEffectClientRpc();
|
||||||
|
|
||||||
// 애니메이션 (있는 경우)
|
// 애니메이션 (있는 경우)
|
||||||
@@ -237,7 +228,6 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
_animator.SetTrigger("Revive");
|
_animator.SetTrigger("Revive");
|
||||||
Debug.Log($"<color=green>[Player] {gameObject.name} 리스폰!</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
@@ -296,14 +286,11 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
|||||||
|
|
||||||
int healAmount = Mathf.Min(amount, maxHealth - _currentHealth.Value);
|
int healAmount = Mathf.Min(amount, maxHealth - _currentHealth.Value);
|
||||||
_currentHealth.Value += healAmount;
|
_currentHealth.Value += healAmount;
|
||||||
|
|
||||||
Debug.Log($"<color=green>[Player] {gameObject.name}이(가) {healAmount} 회복되었습니다. 현재 체력: {_currentHealth.Value}/{maxHealth}</color>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnHealthChanged(int previousValue, int newValue)
|
private void OnHealthChanged(int previousValue, int newValue)
|
||||||
{
|
{
|
||||||
// 체력바 UI 업데이트 또는 체력 변경 시각 효과
|
// 체력바 UI 업데이트 또는 체력 변경 시각 효과
|
||||||
Debug.Log($"<color=yellow>[Player] 체력 변경: {previousValue} → {newValue}</color>");
|
|
||||||
|
|
||||||
// 클라이언트에서도 체력 변경 인지 가능
|
// 클라이언트에서도 체력 변경 인지 가능
|
||||||
if (IsOwner)
|
if (IsOwner)
|
||||||
|
|||||||
@@ -270,10 +270,6 @@ namespace Northbound
|
|||||||
|
|
||||||
ShowGatheringEffectClientRpc();
|
ShowGatheringEffectClientRpc();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[Resource] Worker not in Following state! State: {(int)assignedWorker.CurrentState}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +366,6 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (NetworkManager.Singleton == null || NetworkManager.Singleton.SpawnManager == null)
|
if (NetworkManager.Singleton == null || NetworkManager.Singleton.SpawnManager == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[Resource] FindWorkerForPlayer - NetworkManager or SpawnManager is null");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Northbound
|
|||||||
if (enableOnStart)
|
if (enableOnStart)
|
||||||
{
|
{
|
||||||
_networkManager = NetworkManager.Singleton;
|
_networkManager = NetworkManager.Singleton;
|
||||||
Debug.Log("[SimpleMonitor] Simple Network Monitor started");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,21 +46,39 @@ namespace Northbound
|
|||||||
{
|
{
|
||||||
if (_networkManager == null)
|
if (_networkManager == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("[SimpleMonitor] NetworkManager not found");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isServer = _networkManager.IsServer;
|
bool isServer = _networkManager.IsServer;
|
||||||
bool isClient = _networkManager.IsClient;
|
bool isClient = _networkManager.IsClient;
|
||||||
bool isHost = _networkManager.IsHost;
|
bool isHost = _networkManager.IsHost;
|
||||||
|
|
||||||
if (isServer && !isClient && _eventsLogged < 3)
|
if (isServer && !isClient && _eventsLogged < 3)
|
||||||
{
|
{
|
||||||
_serverStartCount++;
|
_serverStartCount++;
|
||||||
_lastServerStartTime = Time.time;
|
_lastServerStartTime = Time.time;
|
||||||
Debug.Log("[SimpleMonitor] Server started (Count: " + _serverStartCount + ")");
|
|
||||||
_eventsLogged++;
|
_eventsLogged++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isServer && !isClient && _lastServerStartTime > 0f && _eventsLogged < 50)
|
||||||
|
{
|
||||||
|
float uptime = Time.time - _lastServerStartTime;
|
||||||
|
_serverStopCount++;
|
||||||
|
_eventsLogged++;
|
||||||
|
|
||||||
|
if (_serverStopCount >=3)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isServer && _serverStartCount > 0)
|
||||||
|
{
|
||||||
|
if (_eventsLogged % 10 ==0)
|
||||||
|
{
|
||||||
|
float uptime = Time.time - _lastServerStartTime;
|
||||||
|
_eventsLogged++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isServer && !isClient && _lastServerStartTime > 0f && _eventsLogged < 50)
|
if (!isServer && !isClient && _lastServerStartTime > 0f && _eventsLogged < 50)
|
||||||
{
|
{
|
||||||
@@ -96,20 +113,11 @@ namespace Northbound
|
|||||||
_serverStartCount = 0;
|
_serverStartCount = 0;
|
||||||
_lastServerStartTime = 0f;
|
_lastServerStartTime = 0f;
|
||||||
_eventsLogged = 0;
|
_eventsLogged = 0;
|
||||||
Debug.Log("[SimpleMonitor] Counters reset");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ContextMenu("Show Stats")]
|
[ContextMenu("Show Stats")]
|
||||||
public void ShowStats()
|
public void ShowStats()
|
||||||
{
|
{
|
||||||
Debug.Log("=== SIMPLE MONITOR STATS ===");
|
|
||||||
Debug.Log("Server Stops: " + _serverStopCount);
|
|
||||||
Debug.Log("Server Starts: " + _serverStartCount);
|
|
||||||
Debug.Log("NetworkManager:");
|
|
||||||
Debug.Log(" IsServer: " + (_networkManager != null ? _networkManager.IsServer.ToString() : "null"));
|
|
||||||
Debug.Log(" IsClient: " + (_networkManager != null ? _networkManager.IsClient.ToString() : "null"));
|
|
||||||
Debug.Log(" IsHost: " + (_networkManager != null ? _networkManager.IsHost.ToString() : "null"));
|
|
||||||
Debug.Log("============================");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user