use of com.gemserk.commons.artemis.WorldWrapper in project commons-gdx by gemserk.
the class ContainerSystemTest method shouldRemoveChildrenIfParentRemoved.
@Test
public void shouldRemoveChildrenIfParentRemoved() {
World world = new World();
WorldWrapper worldWrapper = new WorldWrapper(world);
worldWrapper.addUpdateSystem(new ContainerSystem());
worldWrapper.addUpdateSystem(new OwnerSystem());
worldWrapper.init();
Entity e1 = world.createEntity();
e1.addComponent(new ContainerComponent());
e1.refresh();
Entity e2 = world.createEntity();
e2.addComponent(new OwnerComponent(e1));
e2.refresh();
worldWrapper.update(10);
world.deleteEntity(e1);
worldWrapper.update(1);
worldWrapper.update(1);
Entity e3 = world.getEntity(e2.getId());
assertThat(e3, IsNull.nullValue());
}
use of com.gemserk.commons.artemis.WorldWrapper in project commons-gdx by gemserk.
the class ContainerSystemTest method shouldBeAddedToParentContainer.
@Test
public void shouldBeAddedToParentContainer() {
World world = new World();
WorldWrapper worldWrapper = new WorldWrapper(world);
worldWrapper.addUpdateSystem(new ContainerSystem());
worldWrapper.addUpdateSystem(new OwnerSystem());
worldWrapper.init();
Entity e1 = world.createEntity();
e1.addComponent(new ContainerComponent());
e1.refresh();
Entity e2 = world.createEntity();
e2.addComponent(new OwnerComponent(e1));
e2.refresh();
worldWrapper.update(10);
ContainerComponent containerComponent = e1.getComponent(ContainerComponent.class);
assertThat(containerComponent.getChildren().contains(e2), IsEqual.equalTo(true));
}
use of com.gemserk.commons.artemis.WorldWrapper in project commons-gdx by gemserk.
the class MultipleImplementationsSameComponentTest method shouldHandleSpecificComponentImplementation.
@Test
public void shouldHandleSpecificComponentImplementation() {
World world = new World();
WorldWrapper worldWrapper = new WorldWrapper(world);
worldWrapper.addUpdateSystem(new FirstImplementationSystem());
worldWrapper.init();
Entity e1 = world.createEntity();
e1.addComponent(new FirstImplementationComponent());
e1.refresh();
worldWrapper.update(100);
}
use of com.gemserk.commons.artemis.WorldWrapper in project commons-gdx by gemserk.
the class MultipleImplementationsSameComponentWorkaroundTest method shouldHandleSpecificComponentImplementation.
@Test
public void shouldHandleSpecificComponentImplementation() {
World world = new World();
WorldWrapper worldWrapper = new WorldWrapper(world);
worldWrapper.addUpdateSystem(new SpatialSystem());
worldWrapper.init();
Entity e1 = world.createEntity();
e1.addComponent(new SpatialComponent(new SpatialFirstImpl()));
e1.refresh();
worldWrapper.update(100);
}
use of com.gemserk.commons.artemis.WorldWrapper in project commons-gdx by gemserk.
the class MultipleImplementationsSameComponentWorkaroundTest method shouldNotHandleSpecificComponentImplementation.
@Test
public void shouldNotHandleSpecificComponentImplementation() {
World world = new World();
WorldWrapper worldWrapper = new WorldWrapper(world);
worldWrapper.addUpdateSystem(new SpatialSystem());
worldWrapper.init();
Entity e1 = world.createEntity();
e1.addComponent(new SpatialComponent(new SpatialSecondImpl()));
e1.refresh();
worldWrapper.update(100);
}
Aggregations