update tùm lum tùm la
This commit is contained in:
@@ -88,7 +88,13 @@ namespace OnlyScove.Scripts
|
||||
|
||||
public void OnInteract(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed) OnInteractEvent?.Invoke();
|
||||
Debug.Log($"[InputReader] Interaction State: {context.phase} | Started: {context.started} | Performed: {context.performed} | Canceled: {context.canceled}");
|
||||
|
||||
if (context.performed)
|
||||
{
|
||||
Debug.Log("[InputReader] Event OnInteractEvent triggered!");
|
||||
OnInteractEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNext(InputAction.CallbackContext context)
|
||||
|
||||
@@ -101,24 +101,17 @@ namespace OnlyScove.Scripts
|
||||
private void UpdateInteractablesList()
|
||||
{
|
||||
interactablesNearby.Clear();
|
||||
Collider[] colliders = Physics.OverlapSphere(transform.position + transform.forward * (InteractionRange / 2), InteractionRange, InteractionMask);
|
||||
foreach (var col in colliders)
|
||||
|
||||
// Sử dụng Scanner để tìm vật thể người chơi đang nhìn vào
|
||||
IInteractable target = Scanner.ScanForInteractable(InteractionRange, InteractionMask);
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
if (col.TryGetComponent(out IInteractable interactable))
|
||||
{
|
||||
if (!interactablesNearby.Contains(interactable))
|
||||
interactablesNearby.Add(interactable);
|
||||
}
|
||||
interactablesNearby.Add(target);
|
||||
}
|
||||
|
||||
if (interactablesNearby.Count == 0)
|
||||
{
|
||||
currentInteractableIndex = 0;
|
||||
}
|
||||
else if (currentInteractableIndex >= interactablesNearby.Count)
|
||||
{
|
||||
currentInteractableIndex = interactablesNearby.Count - 1;
|
||||
}
|
||||
// Reset index vì hiện tại Scanner trả về 1 kết quả chính xác nhất
|
||||
currentInteractableIndex = 0;
|
||||
}
|
||||
|
||||
private void OnNextInteract()
|
||||
|
||||
Reference in New Issue
Block a user