Add AI components and systems for enhanced enemy behavior and pathfinding

This commit is contained in:
2025-10-30 21:53:20 +01:00
parent f65277e6b4
commit c7739de7d9
11 changed files with 370 additions and 6 deletions

View File

@@ -8,14 +8,17 @@ public class GravitySystem : ISystem
{
public void Update(World world, float deltaTime)
{
var entities = world.GetEntitiesWith<VelocityComponent>();
var entities = world.GetEntitiesWith<CharacterStateComponent>();
foreach (var entity in entities)
{
var velocity = world.GetComponent<VelocityComponent>(entity);
var characterState = world.GetComponent<CharacterStateComponent>(entity);
if (velocity == null || characterState == null)
{
world.Logger.Warn("GravitySystem: Missing VelocityComponent or CharacterStateComponent.");
continue;
}
if (!characterState.IsOnFloor) velocity.DesiredVelocity.Y -= world.Config.GravityStrength * deltaTime;
}