34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// A simple component that makes an object interactable
|
|
/// and just notifies the InteractionHandler that it has been interacted with.
|
|
/// Ideal for objects that don't have complex logic but need to be recognized
|
|
/// by the quest system (e.g., a dumpster).
|
|
/// </summary>
|
|
public class NotifyInteractionObject : MonoBehaviour, IInteractable
|
|
{
|
|
[SerializeField]
|
|
private string description = "Interact";
|
|
|
|
public void Interact()
|
|
{
|
|
// Check if InteractionHandler exists
|
|
if (InteractionHandler.Instance != null)
|
|
{
|
|
// Notify the system that this object (gameObject) has been interacted with.
|
|
// The QuestManager, subscribed to this event, will receive the notification.
|
|
InteractionHandler.Instance.NotifyInteraction(gameObject);
|
|
Debug.Log($"Interaction notified for {gameObject.name}");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("InteractionHandler.Instance is not found in the scene.");
|
|
}
|
|
}
|
|
|
|
public string GetDescription()
|
|
{
|
|
return description;
|
|
}
|
|
} |