/** * Creates an entity system that uses the specified aspect as a matcher against entities. * * @param aspect to match against entities */ public EntityProcessor(Aspect aspect) { actives = new Bag<Entity>(); allSet = aspect.getAllSet(); exclusionSet = aspect.getExclusionSet(); oneSet = aspect.getOneSet(); dummy = allSet.isEmpty() && oneSet .isEmpty(); // This system can't possibly be interested in any entity, so it must be // "dummy" }
@Test public void should_be_possible_to_re_add_texturecomponent_via_listener() throws Exception { final Entity enemy = createEnemy(Type.GREEN); createEnemyChangeEvent(); world .getAspectSubscriptionManager() .get(Aspect.all(TextureRef.class).exclude(TextureComponent.class)) .addSubscriptionListener( new EntitySubscription.SubscriptionListener() { @Override public void inserted(IntBag entities) { final int[] data = entities.getData(); for (int i = 0; i < entities.size(); i++) { world.getEntity(data[i]).edit().create(TextureComponent.class); } } @Override public void removed(IntBag entities) {} }); world.process(); assertThat(enemy.getComponent(TextureComponent.class)).isNotNull(); }
public TextureRenderSystem(final float interval) { super( Aspect.getAspectForAll(TextureComponent.class, TransformComponent.class) .exclude(BackgroundComponent.class), interval); this.temp2 = new Vector2(); this.temp2_1 = new Vector2(); }
@Override protected void initialize() { EntityEdit swarm = world.createEntity().edit(); swarm.create(Swarm.class); swarm.create(Bounds.class).setRadius(10); swarm.create(Pos.class); swarmId = swarm.getEntityId(); // we can do about 10k in gwt createSwarm(100); // hmm consume speed/dmg taken based on swarm size && scale? // spread out swarm takes less dmg, but eats slowly, // compact swarms eats fast, but is vulnerable to dmg edibles = world.getAspectSubscriptionManager().get(Aspect.all(Pos.class, Edible.class, Bounds.class)); }
public Scripts() { super(Aspect.all(ScriptComponent.class)); }
public PlayerControlSystem() { super(Aspect.all(PlayerControlled.class, Position.class)); }
public AttachmentSystem() { super(Aspect.all(Pos.class, Attached.class)); }
@SuppressWarnings("unchecked") public PlainPositionSystem2() { super(Aspect.getAspectForAll(PlainPosition.class)); }
public OptimizedSystemAdditional() { super(Aspect.getEmpty()); setEnabled(true); begin(); }
public CostRenderSystem() { super(Aspect.getAspectForAll(Pos.class, Anim.class, Bounds.class, Buildable.class)); }
public ParticleSystem(SpriteBatch batch) { super(Aspect.all(Particle.class)); this.batch = batch; }
public IntOptimizedSystemAdditional() { super(Aspect.all()); setEnabled(true); begin(); }
public SomeSystem() { super(Aspect.getAspectForAll(ExtPosition.class).exclude(Position.class)); }
public MapCollisionSystem() { super(Aspect.getAspectForAll(Physics.class, Pos.class, Bounds.class)); }
@SuppressWarnings("unchecked") public BombAttackerScriptingSystem(ScriptEngine engine) { super(Aspect.getAspectForAll(Script.class, BombAttacker.class, Velocity.class)); this.engine = engine; }
@SuppressWarnings("unchecked") public SimpleExampleSystem(float interval) { super(Aspect.all(ModelComponent.class, KinematicObject.class), interval); }
public LocalCollisionSystem() { super(Aspect.all(BulletComponent.class)); }
@SuppressWarnings("unchecked") public PoliciesSystem() { super(Aspect.getAspectForAll(Policies.class)); }
public MovementSystem() { super(Aspect.all(Position.class, Velocity.class)); }
public EntitiesCollector() { super(Aspect.all(Layer.class)); }
@SuppressWarnings("unchecked") public HealingSystem(final float interval) { super(Aspect.getAspectForAll(Health.class), interval); }
@SuppressWarnings("unchecked") public ShapeRenderSystem(OrthographicCamera camera) { super(Aspect.getAspectForAll(Position.class).one(Circle.class, Rectangle.class)); this.camera = camera; }
public TreeAttachSystem() { super(Aspect.getAspectForAll(TransformComponent.class)); roots = new ArrayBag<>(); }
public HudRenderSystem(GameContainer container) { super(Aspect.getAspectFor()); this.container = container; this.g = container.getGraphics(); }
public SwarmSystem() { super(Aspect.all(Pos.class, Swarmer.class)); }
public ShowerSystem() { super( Aspect.all(Shower.class, Pos.class, Bounds.class), Aspect.all(Ingredient.class, Pos.class, Bounds.class).exclude(SpawnProtected.class)); }
public CameraSystem() { super(Aspect.getAspectForAll(Camera.class)); }
public BasicSystem() { super(Aspect.all(TestMarker.class)); }
@SuppressWarnings("unchecked") public GlobalScriptSystem() { super(Aspect.getAspectForAll(ScriptComponent.class)); }
@SuppressWarnings("unchecked") public Es2() { super(Aspect.all(ComponentX.class).exclude(ComponentY.class)); }