Implement inventory system with item management and pickup functionality

This commit is contained in:
2025-10-13 18:29:50 +02:00
parent ce3596efaa
commit 56ffa8e126
10 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using GameCore.ECS;
using GameCore.ECS.Interfaces;
using GameCore.Events;
namespace GameCore.Inventory;
public class InventorySystem : ISystem
{
private readonly World _world;
public InventorySystem(World world)
{
_world = world;
_world.Subscribe<AddItemToInventoryEvent>(OnAddItem);
}
public void Update(World world, float deltaTime)
{
}
private void OnAddItem(AddItemToInventoryEvent e)
{
var inventory = _world.GetComponent<InventoryComponent>(e.Target);
inventory?.AddItem(e.Item);
}
}