did i really spend less than an hour working on this game over the course of an entire week? yes!

This commit is contained in:
Sylvia 2026-08-28 23:30:08 -07:00
parent b842289076
commit 4a80a6ed0f
10 changed files with 113 additions and 1 deletions

View file

@ -1,8 +1,35 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CraftingSystem : MonoBehaviour
{
#region Statication
public static CraftingSystem instance;
private void Awake()
{
if (instance != null && instance != this)
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(this);
instance = this;
}
#endregion
public List<Item> knownCraftables = new();
[Header("UI")]
public Transform craftableUIGrid;
public CraftableUIObject templateCraftButton;
public void UpdateKnownCraftables(Item newCraftable)
{
knownCraftables.Add(newCraftable);
CraftableUIObject newButton = Instantiate(templateCraftButton, craftableUIGrid);
newButton.SetObject(newCraftable);
}
public bool TryCraftingItem(Item requestedItem)
{
List<InventoryManager.ItemAmount> missingItems = new();