건설 인터랙션 관련 버그 수정 및 건설 데이터 구조 개선
건설 인터랙션 시 움직이지 못하는 문제 수정 2개로 분리되어 있던 타워 데이터를 하나로 통합 - 대신 타워가 아닌 건물도 공격력 등을 정의할 수 있음
This commit is contained in:
@@ -3,6 +3,7 @@ using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.EventSystems;
|
||||
using Northbound.Data;
|
||||
|
||||
namespace Northbound
|
||||
{
|
||||
@@ -248,20 +249,20 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
TowerData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
if (data == null)
|
||||
{
|
||||
Debug.LogError($"[BuildingPlacement] BuildingData is NULL at index {selectedBuildingIndex}");
|
||||
Debug.LogError($"[BuildingPlacement] TowerData 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'");
|
||||
Debug.LogError($"[BuildingPlacement] TowerData.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] TowerData: {data.buildingName}, Prefab: {data.prefab.name}</color>");
|
||||
Debug.Log($"<color=green>[BuildingPlacement] Prefab scale: {data.prefab.transform.localScale}</color>");
|
||||
|
||||
// 완성 건물 프리팹으로 프리뷰 생성 (사용자가 완성 모습을 볼 수 있도록)
|
||||
@@ -319,7 +320,7 @@ namespace Northbound
|
||||
if (selectedBuildingIndex < 0 || selectedBuildingIndex >= BuildingManager.Instance.availableBuildings.Count)
|
||||
return;
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
TowerData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
if (data == null || data.prefab == null)
|
||||
return;
|
||||
|
||||
@@ -444,10 +445,10 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
BuildingData data = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
TowerData 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.");
|
||||
Debug.LogError($"[BuildingPlacement] TowerData or prefab is null at index {selectedBuildingIndex}. Please run 'Northbound > Populate Towers from Prefabs' and update BuildingManager.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -516,7 +517,7 @@ namespace Northbound
|
||||
}
|
||||
}
|
||||
|
||||
private List<Vector3> CalculateDragBuildingPositions(Vector3 start, Vector3 end, BuildingData data)
|
||||
private List<Vector3> CalculateDragBuildingPositions(Vector3 start, Vector3 end, TowerData data)
|
||||
{
|
||||
List<Vector3> positions = new List<Vector3>();
|
||||
|
||||
@@ -566,7 +567,7 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
BuildingData selectedData = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
TowerData selectedData = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
|
||||
int successCount = 0;
|
||||
foreach (var position in dragBuildingPositions)
|
||||
@@ -606,7 +607,7 @@ namespace Northbound
|
||||
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, maxPlacementDistance, groundLayer))
|
||||
{
|
||||
BuildingData selectedData = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
TowerData selectedData = BuildingManager.Instance.availableBuildings[selectedBuildingIndex];
|
||||
|
||||
if (BuildingManager.Instance.IsValidPlacement(selectedData, hit.point, currentRotation, out Vector3 groundPosition))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user