Item HUD management

This commit is contained in:
Marco 2025-01-31 13:03:38 +01:00
commit 13c4489017
17 changed files with 215 additions and 44 deletions

View file

@ -10,6 +10,12 @@ public partial class InventoryManager : Node2D
public bool RedKeycard { get; set; }
private List<LootItem> _items = new List<LootItem>();
[Signal]
public delegate void ItemAddedEventHandler(LootItem item);
[Signal]
public delegate void ItemRemovedEventHandler(LootItem item);
// Called when the node enters the scene tree for the first time.
public override void _Ready()
@ -33,8 +39,10 @@ public partial class InventoryManager : Node2D
public bool AddItem(ItemTypes type, int amount = 1)
{
_items.Add(new LootItem() { Item = type, Amount = amount });
var item = new LootItem() { Item = type, Amount = amount };
_items.Add(item);
GD.Print($"Added {type} x{amount}");
EmitSignal(nameof(ItemAdded), item);
// switch (type)
// {
// // case ItemTypes.KeycardRed: