update tùm lum tùm la
This commit is contained in:
@@ -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