use of com.artemis.Entity in project commons-gdx by gemserk.
the class EntityTemplateTest method weaponInstantiateBullet.
@Deprecated
public void weaponInstantiateBullet() {
EntityTemplate bulletTemplate = new BulletEntityTemplate();
// modifies the template forever, if we are using the same template in different weapons or something similar, then they will be modified as well.
// bulletTemplate.getDefaultParameters().put("damage", new Float(200f));
EntityFactory entityFactory = new EntityFactoryImpl(new World());
Entity bullet = entityFactory.instantiate(bulletTemplate);
DamageComponent damageComponent = bullet.getComponent(DamageComponent.class);
assertThat(damageComponent.getDamage(), IsEqual.equalTo(200f));
}
use of com.artemis.Entity 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.artemis.Entity 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.artemis.Entity 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);
}
use of com.artemis.Entity in project commons-gdx by gemserk.
the class OrderedByLayerEntitiesTest method shouldReturnEntityFirstIfGreaterLayerInverted.
@Test
public void shouldReturnEntityFirstIfGreaterLayerInverted() {
World world = new World();
Entity e1 = world.createEntity();
Entity e2 = world.createEntity();
e1.addComponent(new RenderableComponent(1));
e2.addComponent(new RenderableComponent(0));
orderedByLayerEntities.add(e1);
orderedByLayerEntities.add(e2);
assertSame(orderedByLayerEntities.get(0), e2);
assertSame(orderedByLayerEntities.get(1), e1);
}
Aggregations