31 lines
1023 B
C#
31 lines
1023 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Encompass {
|
|
public abstract class Engine {
|
|
private EntityManager entityManager;
|
|
private ComponentManager componentManager;
|
|
|
|
internal void AssignEntityManager(EntityManager entityManager) {
|
|
this.entityManager = entityManager;
|
|
}
|
|
|
|
internal void AssignComponentManager(ComponentManager componentManager) {
|
|
this.componentManager = componentManager;
|
|
}
|
|
|
|
public abstract void Update(float dt);
|
|
|
|
protected Entity CreateEntity() {
|
|
return this.entityManager.CreateEntity();
|
|
}
|
|
|
|
protected IEnumerable<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent {
|
|
return this.componentManager.GetActiveComponentsByType<TComponent>();
|
|
}
|
|
|
|
protected TComponent ReadComponent<TComponent>() where TComponent : struct, IComponent {
|
|
return this.componentManager.GetActiveComponentByType<TComponent>();
|
|
}
|
|
}
|
|
}
|