Small updates to dispatchers in items and puzzles

This commit is contained in:
2025-09-26 14:06:03 +02:00
committed by Michal Pikulski
parent 0bb3ad10a0
commit c8cbc45f04
10 changed files with 531 additions and 182 deletions

View File

@@ -1,5 +1,6 @@
using Input;
using UnityEngine;
using System; // added for Action<T>
namespace Interactions
{
@@ -11,6 +12,9 @@ namespace Interactions
protected Interactable Interactable;
private PlayerTouchController _playerRef;
protected FollowerController FollowerController;
// Event: invoked when the item was picked up successfully
public event Action<PickupItemData> OnItemPickedUp;
/// <summary>
/// Unity Awake callback. Sets up icon, interactable, and event handlers.
@@ -89,7 +93,14 @@ namespace Interactions
}
FollowerController?.TryPickupItem(gameObject, itemData);
Interactable.BroadcastInteractionComplete(combinationResult == FollowerController.CombinationResult.NotApplicable);
bool wasPickedUp = (combinationResult == FollowerController.CombinationResult.NotApplicable);
Interactable.BroadcastInteractionComplete(wasPickedUp);
// Invoke native C# event when the item was picked up successfully
if (wasPickedUp)
{
OnItemPickedUp?.Invoke(itemData);
}
}
}
}