コード例 #1
0
 /**
  * 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"
 }
コード例 #2
0
  @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();
  }
コード例 #3
0
 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();
 }
コード例 #4
0
ファイル: SwarmSystem.java プロジェクト: davebaol/ld34
  @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));
  }
コード例 #5
0
ファイル: Scripts.java プロジェクト: piotr-j/tastyjam
 public Scripts() {
   super(Aspect.all(ScriptComponent.class));
 }
 public PlayerControlSystem() {
   super(Aspect.all(PlayerControlled.class, Position.class));
 }
コード例 #7
0
 public AttachmentSystem() {
   super(Aspect.all(Pos.class, Attached.class));
 }
コード例 #8
0
 @SuppressWarnings("unchecked")
 public PlainPositionSystem2() {
   super(Aspect.getAspectForAll(PlainPosition.class));
 }
コード例 #9
0
  public OptimizedSystemAdditional() {
    super(Aspect.getEmpty());

    setEnabled(true);
    begin();
  }
コード例 #10
0
 public CostRenderSystem() {
   super(Aspect.getAspectForAll(Pos.class, Anim.class, Bounds.class, Buildable.class));
 }
コード例 #11
0
 public ParticleSystem(SpriteBatch batch) {
   super(Aspect.all(Particle.class));
   this.batch = batch;
 }
コード例 #12
0
  public IntOptimizedSystemAdditional() {
    super(Aspect.all());

    setEnabled(true);
    begin();
  }
コード例 #13
0
ファイル: SomeSystem.java プロジェクト: voidburn/ecs-matrix
 public SomeSystem() {
   super(Aspect.getAspectForAll(ExtPosition.class).exclude(Position.class));
 }
コード例 #14
0
 public MapCollisionSystem() {
   super(Aspect.getAspectForAll(Physics.class, Pos.class, Bounds.class));
 }
コード例 #15
0
 @SuppressWarnings("unchecked")
 public BombAttackerScriptingSystem(ScriptEngine engine) {
   super(Aspect.getAspectForAll(Script.class, BombAttacker.class, Velocity.class));
   this.engine = engine;
 }
コード例 #16
0
 @SuppressWarnings("unchecked")
 public SimpleExampleSystem(float interval) {
   super(Aspect.all(ModelComponent.class, KinematicObject.class), interval);
 }
コード例 #17
0
 public LocalCollisionSystem() {
   super(Aspect.all(BulletComponent.class));
 }
コード例 #18
0
 @SuppressWarnings("unchecked")
 public PoliciesSystem() {
   super(Aspect.getAspectForAll(Policies.class));
 }
コード例 #19
0
 public MovementSystem() {
   super(Aspect.all(Position.class, Velocity.class));
 }
コード例 #20
0
 public EntitiesCollector() {
   super(Aspect.all(Layer.class));
 }
コード例 #21
0
ファイル: HealingSystem.java プロジェクト: veasmkii/barter
 @SuppressWarnings("unchecked")
 public HealingSystem(final float interval) {
   super(Aspect.getAspectForAll(Health.class), interval);
 }
コード例 #22
0
 @SuppressWarnings("unchecked")
 public ShapeRenderSystem(OrthographicCamera camera) {
   super(Aspect.getAspectForAll(Position.class).one(Circle.class, Rectangle.class));
   this.camera = camera;
 }
コード例 #23
0
 public TreeAttachSystem() {
   super(Aspect.getAspectForAll(TransformComponent.class));
   roots = new ArrayBag<>();
 }
コード例 #24
0
  public HudRenderSystem(GameContainer container) {
    super(Aspect.getAspectFor());

    this.container = container;
    this.g = container.getGraphics();
  }
コード例 #25
0
ファイル: SwarmSystem.java プロジェクト: davebaol/ld34
 public SwarmSystem() {
   super(Aspect.all(Pos.class, Swarmer.class));
 }
コード例 #26
0
  public ShowerSystem() {

    super(
        Aspect.all(Shower.class, Pos.class, Bounds.class),
        Aspect.all(Ingredient.class, Pos.class, Bounds.class).exclude(SpawnProtected.class));
  }
コード例 #27
0
ファイル: CameraSystem.java プロジェクト: jokeofweek/orpg
 public CameraSystem() {
   super(Aspect.getAspectForAll(Camera.class));
 }
 public BasicSystem() {
   super(Aspect.all(TestMarker.class));
 }
コード例 #29
0
 @SuppressWarnings("unchecked")
 public GlobalScriptSystem() {
   super(Aspect.getAspectForAll(ScriptComponent.class));
 }
コード例 #30
0
 @SuppressWarnings("unchecked")
 public Es2() {
   super(Aspect.all(ComponentX.class).exclude(ComponentY.class));
 }