ReisenTasker/Assets/Scripts/GatheringSpot.cs

32 lines
608 B
C#

using System;
using System.Collections.Generic;
using UnityEngine;
public class GatheringSpot : MonoBehaviour
{
[Serializable]
public class ItemAmount
{
public Item item;
public int amount;
}
public List<ItemAmount> gatherableItems = new();
public bool hasGathered;
public void Gather()
{
foreach (ItemAmount item in gatherableItems)
{
InventoryManager.instance.AddItem(item.item, item.amount);
//needs check for if inventory cannot fit
}
hasGathered = true;
gameObject.SetActive(false);
}
private void OnMouseDown()
{
//placeholder function to add items
Gather();
}
}