41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace Quest_Environment.Q2
|
|
{
|
|
public class PickupBroomAction : MonoBehaviour, IInteractable
|
|
{
|
|
[Header("Settings")]
|
|
public ItemData broomItemData;
|
|
|
|
public void Interact()
|
|
{
|
|
// Check if the current quest is the correct one for this item
|
|
if (!(QuestManager.Instance?.currentQuest is Q2_SweepDirtQuest))
|
|
{
|
|
Debug.Log("I have no reason to pick this up right now.");
|
|
return; // Do nothing if it's not the right quest
|
|
}
|
|
|
|
bool added = InventorySystem.Instance.AddItem(broomItemData);
|
|
|
|
if (added)
|
|
{
|
|
if (InteractionHandler.Instance != null)
|
|
{
|
|
InteractionHandler.Instance.NotifyInteraction(gameObject);
|
|
}
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public string GetDescription()
|
|
{
|
|
// Only show the description if the correct quest is active
|
|
if (QuestManager.Instance?.currentQuest is Q2_SweepDirtQuest)
|
|
{
|
|
return "Take the broom";
|
|
}
|
|
return ""; // Return empty string to hide the prompt
|
|
}
|
|
}
|
|
} |