stack item pickup (in progress), throwable hand consumes items, spawnable objects tied to item definitions

This commit is contained in:
2026-09-16 22:48:52 -05:00
parent d8295719b0
commit f4642ea005
17 changed files with 444 additions and 26 deletions
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class ItemInstantiationManager : MonoBehaviour
{
private Dictionary<ItemIdEnum, GameObject> spawnablePrefabs = new Dictionary<ItemIdEnum, GameObject>();
private void Awake()
{
LoadSpawnablePrefabs();
}
private void LoadSpawnablePrefabs()
{
foreach (ItemIdEnum itemId in Enum.GetValues(typeof(ItemIdEnum)))
{
Item item = ItemUtilities.GetItemFromId(itemId);
if (item.throwable)
{
GameObject prefab = Resources.Load<GameObject>($"SpawnablePrefabs/ID_{itemId.ToString()}");
if (prefab != null)
{
spawnablePrefabs.Add(itemId, prefab);
}
}
}
}
public GameObject GetThrowablePrefab(ItemIdEnum itemId)
{
return spawnablePrefabs[itemId];
}
}