Add inventory and pickup components with associated resources and presenters

This commit is contained in:
2025-10-13 18:29:58 +02:00
parent ad3e631d8c
commit 329a942de7
5 changed files with 79 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ using GameCore.Attributes;
using GameCore.Combat;
using GameCore.ECS.Interfaces;
using GameCore.Input;
using GameCore.Inventory;
using GameCore.Movement;
using GameCore.Physics;
using GameCore.Player;
@@ -29,6 +30,8 @@ public class ComponentFactory
Register<PlayerComponentResource>(_ => new PlayerComponent());
Register<RotationComponentResource>(_ => new RotationComponent());
Register<CharacterStateComponentResource>(_ => new CharacterStateComponent());
Register<InventoryComponentResource>(_ => new InventoryComponent());
Register<PickupComponentResource>(CreatePickupComponent);
}
public IComponent Create(Resource resource)
@@ -77,4 +80,14 @@ public class ComponentFactory
Lifetime = resource.Lifetime,
};
}
private PickupComponent CreatePickupComponent(PickupComponentResource resource)
{
return new PickupComponent
{
ItemId = resource.ItemId,
Quantity = resource.Quantity,
IsInstantUse = resource.IsInstantUse
};
}
}