use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGame in project lionengine by b3dgs.
the class UtilExtractable method createExtractable.
/**
* Create extractable.
*
* @param services The services reference (must not be <code>null</code>).
* @param setup The setup reference (must not be <code>null</code>).
* @return The extractable.
*/
public static Extractable createExtractable(Services services, Setup setup) {
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.setResourcesQuantity(10);
extractable.setResourcesType("wood");
extractable.prepare(featurable);
return extractable;
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGame 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();
}
Aggregations