장비 개념 추가 및 Kaykit 애셋 추가
This commit is contained in:
@@ -39,9 +39,9 @@ public class PlayerNetworkController : NetworkBehaviour
|
||||
[SerializeField] private float visionRadius = 5f; // 시야 반경
|
||||
private float _lastRevealTime;
|
||||
|
||||
[Header("Action System")]
|
||||
[SerializeField] private PlayerActionData miningAction; // 채광에 대한 시간/애니메이션/효과 데이터
|
||||
private PlayerActionHandler _actionHandler; // 새 핸들러 연결[Header("Action Data")]
|
||||
[Header("Inventory & Action")]
|
||||
private PlayerInventory _inventory; // 인벤토리 참조 추가
|
||||
private PlayerActionHandler _actionHandler;
|
||||
|
||||
private RectTransform _crosshairRect;
|
||||
private MineableBlock _currentTargetBlock; // 현재 강조 중인 블록 저장
|
||||
@@ -105,6 +105,13 @@ public class PlayerNetworkController : NetworkBehaviour
|
||||
_inputActions.Player.Interact.started += ctx => _isHoldingInteract = true;
|
||||
_inputActions.Player.Interact.canceled += ctx => _isHoldingInteract = false;
|
||||
|
||||
_inputActions.Player.Select1.performed += ctx => _inventory.ChangeSelectedSlotRpc(0);
|
||||
_inputActions.Player.Select2.performed += ctx => _inventory.ChangeSelectedSlotRpc(1);
|
||||
_inputActions.Player.Select3.performed += ctx => _inventory.ChangeSelectedSlotRpc(2);
|
||||
_inputActions.Player.Select4.performed += ctx => _inventory.ChangeSelectedSlotRpc(3);
|
||||
_inputActions.Player.Select5.performed += ctx => _inventory.ChangeSelectedSlotRpc(4);
|
||||
_inputActions.Player.Select6.performed += ctx => _inventory.ChangeSelectedSlotRpc(5);
|
||||
|
||||
_inputActions.Enable();
|
||||
}
|
||||
|
||||
@@ -113,7 +120,12 @@ public class PlayerNetworkController : NetworkBehaviour
|
||||
_controller = GetComponent<CharacterController>();
|
||||
_animator = GetComponent<Animator>();
|
||||
_traveler = GetComponent<TunnelTraveler>();
|
||||
|
||||
// --- 참조 초기화 추가 ---
|
||||
_inventory = GetComponent<PlayerInventory>();
|
||||
_actionHandler = GetComponent<PlayerActionHandler>();
|
||||
|
||||
if (_inventory == null) Debug.LogError("PlayerInventory 컴포넌트를 찾을 수 없습니다!");
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -175,13 +187,31 @@ public class PlayerNetworkController : NetworkBehaviour
|
||||
}
|
||||
|
||||
// 1. 액션 (좌클릭) - 대상이 없어도 나감
|
||||
// PlayerNetworkController.cs 중 일부
|
||||
private void OnActionInput()
|
||||
{
|
||||
if (!IsOwner || _actionHandler.IsBusy) return;
|
||||
|
||||
// 조준 중인 블록이 있으면 넘기고, 없으면 null을 넘겨서 실행
|
||||
GameObject target = _lastHighlightedBlock?.gameObject;
|
||||
_actionHandler.PerformAction(miningAction, target);
|
||||
ItemData selectedItem = _inventory.GetSelectedItemData();
|
||||
|
||||
// 로그 1: 아이템 확인
|
||||
if (selectedItem == null) { Debug.Log("선택된 아이템이 없음"); return; }
|
||||
|
||||
// 로그 2: 도구 여부 및 액션 데이터 확인
|
||||
Debug.Log($"현재 아이템: {selectedItem.itemName}, 도구여부: {selectedItem.isTool}, 액션데이터: {selectedItem.toolAction != null}");
|
||||
|
||||
if (selectedItem.isTool && selectedItem.toolAction != null)
|
||||
{
|
||||
if (_lastHighlightedBlock != null)
|
||||
{
|
||||
Debug.Log($"채광 시작: {_lastHighlightedBlock.name}");
|
||||
_actionHandler.PerformAction(selectedItem.toolAction, _lastHighlightedBlock.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("조준된 블록이 없음 (하이라이트 확인 필요)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 인터랙션 (F키) - 대상이 없으면 아예 시작 안 함
|
||||
|
||||
Reference in New Issue
Block a user