Add inventory and pickup components with associated resources and presenters
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user