Add button interaction system with event publishing and requirements handling
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user