[Input][Interaction] Add interactable items
This commit is contained in:
20
Assets/Scripts/Interactable.cs
Normal file
20
Assets/Scripts/Interactable.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
public class Interactable : MonoBehaviour, ITouchInputConsumer
|
||||
{
|
||||
public event Action Interacted;
|
||||
|
||||
// Called by InputManager when this interactable is clicked/touched
|
||||
public void OnTouchPress(Vector2 worldPosition)
|
||||
{
|
||||
Debug.Log($"Interactable.OnTouchPress at {worldPosition} on {gameObject.name}");
|
||||
Interacted?.Invoke();
|
||||
}
|
||||
|
||||
public void OnTouchPosition(Vector2 screenPosition)
|
||||
{
|
||||
// Optionally handle drag/move here
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user