Add AI components and systems for enhanced enemy behavior and pathfinding
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using GameCore.AI;
|
||||
using GameCore.ECS;
|
||||
using GameCore.ECS.Interfaces;
|
||||
using GameCore.Player;
|
||||
@@ -8,12 +9,26 @@ public class PlayerInputSystem : ISystem
|
||||
{
|
||||
public void Update(World world, float deltaTime)
|
||||
{
|
||||
var playerEntities = world.GetEntitiesWith<PlayerComponent>();
|
||||
if (!playerEntities.Any()) return;
|
||||
var playerEntities = world.GetEntitiesWith<PlayerComponent>().ToList();
|
||||
if (!playerEntities.Any())
|
||||
{
|
||||
world.Logger.Warn("No player entity found for input processing.");
|
||||
return;
|
||||
}
|
||||
|
||||
var playerEntity = playerEntities.First();
|
||||
if (world.GetComponent<AIComponent>(playerEntity) != null)
|
||||
{
|
||||
world.Logger.Warn("Player entity has AIComponent; skipping input processing.");
|
||||
return;
|
||||
}
|
||||
|
||||
var inputState = world.GetComponent<InputStateComponent>(playerEntity);
|
||||
if (inputState == null) return;
|
||||
if (inputState == null)
|
||||
{
|
||||
world.Logger.Warn("Player entity is missing InputStateComponent; cannot process input.");
|
||||
return;
|
||||
}
|
||||
|
||||
inputState.MoveDirection = world.InputService.MoveDirection.Normalize();
|
||||
inputState.LookDirection = world.InputService.LookDirection;
|
||||
|
||||
Reference in New Issue
Block a user