This commit is contained in:
CortexCore
2024-06-22 17:58:05 +08:00
parent 46b2da988e
commit 07b6fbc2f3
9 changed files with 256 additions and 6 deletions

View File

@@ -26,6 +26,18 @@ namespace BITKit.Entities
}
public CancellationToken CancellationToken { get; private set; }
public IEntityBehavior[] Behaviors { get;private set; }
public bool TryGetComponent(Type type, out IEntityComponent component)
{
var value = genericEvent.Get(type.FullName);
if (value is not null)
{
component = (IEntityComponent)value;
return true;
}
component = default!;
return false;
}
public IEntityComponent[] Components => Behaviors.Cast<IEntityComponent>().ToArray();
private bool _initialized;
bool Entities.IEntity.RegisterComponent<T>(T component)