Improved detective board system
This commit is contained in:
@@ -2,12 +2,13 @@ using UnityEngine;
|
||||
using Unheimlich.Data.DetectiveBoard;
|
||||
using Unheimlich.Interactions.Core;
|
||||
using Unheimlich.Managers;
|
||||
using Unheimlich.Gameplay.Items;
|
||||
|
||||
namespace Unheimlich.Handlers.DetectiveBoard
|
||||
{
|
||||
/// <summary>
|
||||
/// Unlocks a clue when the player interacts with this object.
|
||||
/// Extends InteractableBase to integrate with the existing interaction system.
|
||||
/// Can work standalone (extends InteractableBase) or piggyback on an existing InspectableItem.
|
||||
/// </summary>
|
||||
public class ClueUnlockOnInteraction : InteractableBase
|
||||
{
|
||||
@@ -19,15 +20,27 @@ namespace Unheimlich.Handlers.DetectiveBoard
|
||||
[SerializeField] private bool _unlockOnlyOnce = true;
|
||||
|
||||
private bool _hasUnlocked;
|
||||
private InspectableItem _inspectableItem;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_inspectableItem = GetComponent<InspectableItem>();
|
||||
}
|
||||
|
||||
public override void Interact(GameObject interactor)
|
||||
{
|
||||
if (_unlockOnlyOnce && _hasUnlocked)
|
||||
{
|
||||
if (_inspectableItem != null)
|
||||
_inspectableItem.Interact(interactor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clueToUnlock == null)
|
||||
{
|
||||
Debug.LogError("[ClueUnlockOnInteraction] No clue data assigned!");
|
||||
if (_inspectableItem != null)
|
||||
_inspectableItem.Interact(interactor);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,6 +51,11 @@ namespace Unheimlich.Handlers.DetectiveBoard
|
||||
|
||||
Debug.Log($"[ClueUnlockOnInteraction] Unlocked clue: {_clueToUnlock.Title} via interaction");
|
||||
}
|
||||
|
||||
if (_inspectableItem != null)
|
||||
{
|
||||
_inspectableItem.Interact(interactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user