mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 12:06:37 +00:00
30 lines
880 B
C#
30 lines
880 B
C#
using MonoGame.Extended.Collections;
|
|
|
|
namespace MonoGame.Extended.Entities.Systems
|
|
{
|
|
public abstract class EntityUpdateSystem : UpdateSystem
|
|
{
|
|
protected EntityUpdateSystem(Aspect.Builder aspectBuilder)
|
|
{
|
|
_aspectBuilder = aspectBuilder;
|
|
}
|
|
|
|
private readonly Aspect.Builder _aspectBuilder;
|
|
private EntitySubscription _subscription;
|
|
|
|
private EntityWorld _world;
|
|
public EntityWorld World
|
|
{
|
|
get => _world;
|
|
internal set
|
|
{
|
|
_world = value;
|
|
_subscription = new EntitySubscription(_world.EntityManager, _aspectBuilder.Build(_world.ComponentManager));
|
|
}
|
|
}
|
|
|
|
public Bag<int> ActiveEntities => _subscription.ActiveEntities;
|
|
|
|
public abstract void Initialize(IComponentMapperService mapperService);
|
|
}
|
|
} |