[Input][Interaction] Add interactable items

This commit is contained in:
Michal Pikulski
2025-09-01 16:14:21 +02:00
parent 8b0f6b9376
commit 8e1174d4bf
11 changed files with 725 additions and 79 deletions

View File

@@ -67,10 +67,19 @@ public class InputManager : MonoBehaviour
defaultConsumer?.OnTouchPosition(pos);
}
private bool TryDelegateToInteractable(Vector2 screenPos)
private bool TryDelegateToInteractable(Vector2 worldPos)
{
// TODO: Raycast logic to find ITouchInputConsumer at screenPos
// For now, always return false (no interactable found)
// Raycast at the world position to find an Interactable
Collider2D hit = Physics2D.OverlapPoint(worldPos);
if (hit != null)
{
var interactable = hit.GetComponent<Interactable>();
if (interactable != null)
{
interactable.OnTouchPress(worldPos);
return true;
}
}
return false;
}
}