Add attribute system with core stats and gameplay components

This commit is contained in:
2025-10-13 12:10:45 +02:00
commit ce3596efaa
55 changed files with 1161 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using GameCore.ECS;
using GameCore.ECS.Interfaces;
namespace GameCore.Attributes;
public class AttributeSystem : ISystem
{
public void Update(World world, float deltaTime)
{
var entities = world.GetEntitiesWith<AttributeComponent>();
foreach (var entity in entities)
{
var attributes = world.GetComponent<AttributeComponent>(entity);
if (attributes == null) continue;
var maxHealth = attributes.GetValue(Attribute.MaxHealth);
var currentHealth = attributes.GetValue(Attribute.Health);
if (currentHealth > maxHealth) attributes.SetCurrentValue(Attribute.Health, maxHealth);
}
}
}