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
+19 -4
View File
@@ -9,14 +9,16 @@ public class Item
public int maxStack = 10;
public string description = "";
public string itemImagePath = "";
public bool throwable = false;
public Item(string itemName, ItemIdEnum id, int maxStack, string description, string itemImagePath)
public Item(string itemName, ItemIdEnum id, int maxStack, string description, string itemImagePath, bool throwable = false)
{
this.itemName = itemName;
this.id = id;
this.maxStack = maxStack;
this.description = description;
this.itemImagePath = itemImagePath;
this.throwable = throwable;
}
public Item(ItemIdEnum id)
@@ -28,15 +30,18 @@ public Item(ItemIdEnum id)
this.maxStack = newItem.maxStack;
this.description = newItem.description;
this.itemImagePath= newItem.itemImagePath;
this.throwable = newItem.throwable;
}
}
public enum ItemIdEnum
{
NONE = 0,
STAR_SHARD = 1
STAR_SHARD = 1,
DYNAMITE = 2
}
[System.Serializable]
public static class ItemUtilities
{
// THIS IS WHERE ALL THE ITEMS ARE DEFINED
@@ -50,9 +55,19 @@ public static Item GetItemFromId(ItemIdEnum itemId)
id: itemId,
maxStack: 10,
description: "A rare material that can only be found here in the valley.",
itemImagePath: "ItemSprites/starShard");
itemImagePath: "ItemSprites/starShard",
false);
case ItemIdEnum.DYNAMITE:
return new Item(
itemName: "Dynamite",
id: itemId,
maxStack: 10,
description: "A throwable red stick that goes BOOM (after a short time).",
itemImagePath: "ItemSprites/dynamite",
true);
}
return new Item("", itemId, 0, "", "ItemSprites/noneItem"); ;
return new Item("", itemId, 0, "", "ItemSprites/noneItem");
}
}