Rework interactables into a flatter hierarchy, reenable puzzles as well

This commit is contained in:
Michal Pikulski
2025-09-11 13:00:26 +02:00
parent 3a40d1a151
commit e1ff13db30
32 changed files with 981 additions and 1018 deletions

View File

@@ -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
{