restructure script folder
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user