Rework interactables into a flatter hierarchy, reenable puzzles as well
This commit is contained in:
@@ -157,34 +157,14 @@ public class InputManager : MonoBehaviour
|
||||
Collider2D hit = Physics2D.OverlapPoint(worldPos, mask);
|
||||
if (hit != null)
|
||||
{
|
||||
var interactable = hit.GetComponent<Interactable>();
|
||||
if (interactable != null)
|
||||
{
|
||||
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to interactable at {worldPos} (GameObject: {hit.gameObject.name})");
|
||||
// Find the player Character (by tag)
|
||||
var playerObj = GameObject.FindGameObjectWithTag("Player");
|
||||
var playerCharacter = playerObj != null ? playerObj.GetComponent<Character>() : null;
|
||||
if (playerCharacter != null)
|
||||
{
|
||||
InteractionOrchestrator.Instance.RequestInteraction(interactable, playerCharacter);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[InputManager] Player Character not found for interaction delegation.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Fallback: support other ITouchInputConsumer implementations
|
||||
var consumer = hit.GetComponent<ITouchInputConsumer>();
|
||||
if (consumer != null)
|
||||
{
|
||||
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to consumer at {worldPos} (GameObject: {hit.gameObject.name})");
|
||||
consumer.OnTap(worldPos);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.unityLogger.Log("Interactable", $"[InputManager] Collider2D hit at {worldPos} (GameObject: {hit.gameObject.name}), but no ITouchInputConsumer found.");
|
||||
}
|
||||
Debug.unityLogger.Log("Interactable", $"[InputManager] Collider2D hit at {worldPos} (GameObject: {hit.gameObject.name}), but no ITouchInputConsumer found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user