use of com.b3dgs.lionengine.game.feature.FeaturableModel in project lionengine by b3dgs.
the class ExtractableModelTest method testExtract.
/**
* Test the extraction.
*/
@Test
void testExtract() {
services.add(new MapTileGame());
final Featurable featurable = new FeaturableModel(services, setup);
featurable.addFeature(new TransformableModel(services, setup));
final Extractable extractable = new ExtractableModel(services, setup);
extractable.prepare(featurable);
extractable.setResourcesQuantity(10);
assertEquals(10, extractable.getResourceQuantity());
extractable.extractResource(5);
assertEquals(5, extractable.getResourceQuantity());
extractable.getFeature(Identifiable.class).notifyDestroyed();
}
use of com.b3dgs.lionengine.game.feature.FeaturableModel in project lionengine by b3dgs.
the class UtilProducible method createProducible.
/**
* Create producible.
*
* @param services The services.
* @return The producible.
*/
public static Featurable createProducible(Services services) {
final Media media = createProducibleMedia();
final Setup setup = new Setup(media);
final Featurable featurable = new FeaturableModel(services, setup);
featurable.addFeature(new TransformableModel(services, setup));
featurable.addFeature(new ProducibleModel(services, setup));
return featurable;
}
use of com.b3dgs.lionengine.game.feature.FeaturableModel in project lionengine by b3dgs.
the class MapTileCollisionModelTest method createObject.
/**
* Create object test.
*
* @return The object test.
*/
private Transformable createObject() {
final Setup setup = new Setup(config);
CollisionCategoryConfig.exports(setup.getRoot(), categoryY);
CollisionCategoryConfig.exports(setup.getRoot(), categoryX);
final FeaturableModel object = new FeaturableModel(services, setup);
final Transformable transformable = object.addFeatureAndGet(new TransformableModel(services, setup));
transformable.setSize(1, 1);
final TileCollidable collidable = object.addFeatureAndGet(new TileCollidableModel(services, setup));
collidable.setEnabled(true);
return transformable;
}
Aggregations