건설 인터랙션 관련 버그 수정 및 건설 데이터 구조 개선

건설 인터랙션 시 움직이지 못하는 문제 수정
2개로 분리되어 있던 타워 데이터를 하나로 통합
 - 대신 타워가 아닌 건물도 공격력 등을 정의할 수 있음
This commit is contained in:
2026-02-01 16:09:57 +09:00
parent 7927dab72f
commit 4200288fae
24 changed files with 235 additions and 337 deletions

View File

@@ -12,19 +12,20 @@ namespace Northbound
[Header("Interaction Settings")]
public float interactionRange = 3f;
public LayerMask interactableLayer = ~0;
public float workPower = 10f;
[Header("Detection")]
public Transform rayOrigin;
public bool useForwardDirection = true;
[Header("Animation")]
public bool playAnimations = true;
public bool useAnimationEvents = true;
public bool blockDuringAnimation = true;
[Header("Equipment")]
public bool useEquipment = true;
[Header("Debug")]
public bool showDebugRay = true;
@@ -41,6 +42,7 @@ namespace Northbound
// 다른 컴포넌트가 이동 차단 여부를 확인할 수 있도록 public 프로퍼티 제공
public bool IsInteracting => _isInteracting;
public float WorkPower => workPower;
public override void OnNetworkSpawn()
{
@@ -71,6 +73,17 @@ namespace Northbound
private void Update()
{
if (!IsOwner) return;
// Check if current interactable is no longer valid (e.g., building completed)
if (_isInteracting && _currentInteractable != null)
{
if (!_currentInteractable.CanInteract(OwnerClientId))
{
Debug.Log("[PlayerInteraction] Interactable no longer valid - ending interaction");
EndInteraction();
}
}
DetectInteractable();
}
@@ -243,6 +256,16 @@ namespace Northbound
}
}
private void EndInteraction()
{
_isInteracting = false;
if (_interactionTimeoutCoroutine != null)
{
StopCoroutine(_interactionTimeoutCoroutine);
_interactionTimeoutCoroutine = null;
}
}
private void OnGUI()
{
if (!IsOwner || _currentInteractable == null) return;