Exemplo n.º 1
0
  @Test
  public void removeEntityTwice() {
    PooledEngine engine = new PooledEngine();
    engine.addSystem(new RemoveEntityTwiceSystem());

    for (int j = 0; j < 2; j++) {
      engine.update(0);
    }
  }
Exemplo n.º 2
0
  @Test
  public void entityRemovalListenerOrder() {
    PooledEngine engine = new PooledEngine();

    CombinedSystem combinedSystem = new CombinedSystem();

    engine.addSystem(combinedSystem);
    engine.addEntityListener(Family.all(PositionComponent.class).get(), new MyPositionListener());

    for (int i = 0; i < 10; i++) {
      Entity entity = engine.createEntity();
      entity.add(engine.createComponent(PositionComponent.class));
      engine.addEntity(entity);
    }

    assertEquals(10, combinedSystem.allEntities.size());

    for (int i = 0; i < 10; i++) {
      engine.update(deltaTime);
    }

    engine.removeAllEntities();
  }