데이터파이프라인 타워 부분 개선
This commit is contained in:
@@ -189,6 +189,13 @@ namespace Northbound
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -231,6 +238,10 @@ namespace Northbound
|
||||
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)
|
||||
{
|
||||
Debug.LogWarning($"[BuildingPlacement] 유효하지 않은 건물 인덱스: {selectedBuildingIndex}");
|
||||
@@ -238,12 +249,21 @@ namespace Northbound
|
||||
}
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
if (data == null || data.prefab == null)
|
||||
if (data == null)
|
||||
{
|
||||
Debug.LogWarning("[BuildingPlacement] BuildingData 또는 Prefab이 없습니다.");
|
||||
Debug.LogError($"[BuildingPlacement] BuildingData is NULL at index {selectedBuildingIndex}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.prefab == null)
|
||||
{
|
||||
Debug.LogError($"[BuildingPlacement] BuildingData.prefab is NULL at index {selectedBuildingIndex}. Run 'Northbound > Diagnose Tower System'");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"<color=green>[BuildingPlacement] BuildingData: {data.buildingName}, Prefab: {data.prefab.name}</color>");
|
||||
Debug.Log($"<color=green>[BuildingPlacement] Prefab scale: {data.prefab.transform.localScale}</color>");
|
||||
|
||||
// 완성 건물 프리팹으로 프리뷰 생성 (사용자가 완성 모습을 볼 수 있도록)
|
||||
previewObject = Instantiate(data.prefab);
|
||||
|
||||
@@ -296,11 +316,17 @@ namespace Northbound
|
||||
if (previewObject == null || BuildingManager.Instance == null)
|
||||
return;
|
||||
|
||||
if (selectedBuildingIndex < 0 || selectedBuildingIndex >= BuildingManager.Instance.availableBuildings.Count)
|
||||
return;
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
if (data == null || data.prefab == null)
|
||||
return;
|
||||
|
||||
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, maxPlacementDistance, groundLayer))
|
||||
{
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
|
||||
// Check if placement is valid
|
||||
bool isValid = BuildingManager.Instance.IsValidPlacement(data, hit.point, currentRotation, out Vector3 snappedPosition);
|
||||
@@ -412,13 +438,24 @@ namespace Northbound
|
||||
{
|
||||
if (BuildingManager.Instance == null) return;
|
||||
|
||||
if (selectedBuildingIndex < 0 || selectedBuildingIndex >= BuildingManager.Instance.availableBuildings.Count)
|
||||
{
|
||||
Debug.LogWarning($"[BuildingPlacement] Invalid building index: {selectedBuildingIndex}");
|
||||
return;
|
||||
}
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
if (data == null || data.prefab == null)
|
||||
{
|
||||
Debug.LogError($"[BuildingPlacement] BuildingData or prefab is null at index {selectedBuildingIndex}. Please run 'Northbound > Populate Towers from Prefabs' and update BuildingManager.");
|
||||
return;
|
||||
}
|
||||
|
||||
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||
if (!Physics.Raycast(ray, out RaycastHit hit, maxPlacementDistance, groundLayer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
|
||||
// 드래그 영역 계산
|
||||
Vector3 dragEndPosition = hit.point;
|
||||
|
||||
Reference in New Issue
Block a user