Files
BakeryGame/Systems/HealthSystem.cs
2024-04-18 00:51:12 +07:00

28 lines
590 B
C#

using Raylib_cs;
using Scellecs.Morpeh;
public sealed class HealthSystem : ISystem
{
private Filter filter;
public World World { get; set; }
public void Dispose()
{
}
public void OnAwake()
{
filter = World.Filter.With<HealthComponent>().Build();
}
public void OnUpdate(float deltaTime)
{
foreach (var entity in filter)
{
ref var healthComponent = ref entity.GetComponent<HealthComponent>();
if (Raylib.IsKeyDown(KeyboardKey.Enter))
healthComponent.HealthPoints++;
}
}
}