36 lines
885 B
C#
36 lines
885 B
C#
using UnityEngine;
|
|
|
|
// this class is specifically referring to items in the world that can be picked up
|
|
public class PickupableItem : Interactable
|
|
{
|
|
public ItemIdEnum itemId;
|
|
public int quantity;
|
|
|
|
private Item itemObj;
|
|
|
|
private void Start()
|
|
{
|
|
itemObj = new Item(itemId);
|
|
Debug.Log(itemObj.itemName);
|
|
}
|
|
|
|
public override void Interact()
|
|
{
|
|
if (GameManager.Instance.Inventory.AddItem(itemObj, quantity))
|
|
{
|
|
MoveOutsideRange(); // I don't love this but if we destroy the object we probably need to do this first
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public override void MoveInsideRange()
|
|
{
|
|
GameManager.Instance.DialogueManager.ShowItemText(itemObj.itemName);
|
|
}
|
|
|
|
public override void MoveOutsideRange()
|
|
{
|
|
GameManager.Instance.DialogueManager.HideItemText();
|
|
}
|
|
}
|