Add button interaction system with event publishing and requirements handling

This commit is contained in:
2025-10-30 02:21:33 +01:00
parent 86afb57809
commit 3fcb31d92f
11 changed files with 240 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ using GameCore.ECS.Interfaces;
using GameCore.Events;
using GameCore.Events.Interfaces;
using GameCore.Input.Interfaces;
using GameCore.Interaction;
using GameCore.Logging.Interfaces;
namespace GameCore.ECS;
@@ -112,4 +113,18 @@ public class World(IInputService inputService, IWorldQuery worldQuery, Simulatio
{
_eventBus.Unsubscribe(handler);
}
public Entity? FindEntityByWorldId(string worldId)
{
if (string.IsNullOrEmpty(worldId)) return null;
foreach (var entity in _componentsByEntityId.Keys.Select(id => new Entity(id)))
{
var idComponent = GetComponent<WorldIdComponent>(entity);
if (idComponent != null && idComponent.WorldId == worldId)
return entity;
}
return null;
}
}