Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
24
Assets/Scripts/Systems/Player/PlayerQuickActionsSystem.cs
Normal file
24
Assets/Scripts/Systems/Player/PlayerQuickActionsSystem.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Events;
|
||||
using Unity.Entities;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
public class PlayerQuickActionsSystem : ComponentSystem
|
||||
{
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
Entities.WithAllReadOnly<Slot>()
|
||||
.ForEach(
|
||||
(Entity entity, ref PlayerInput input) =>
|
||||
{
|
||||
var inv = EntityManager.GetBuffer<Slot>(entity);
|
||||
if (input.Heal && inv.Begin().Any(s => s.Type == SlotType.Health) && !EntityManager.HasComponent<ItemUseEventData>(entity))
|
||||
{
|
||||
PostUpdateCommands.AddComponent(
|
||||
entity,
|
||||
new ItemUseEventData { Inventory = entity, Slot = inv.Begin().IndexOf(e => e.Type == SlotType.Health) });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue