Search in sources :

Example 26 with MapTileGame

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;
}
Also used : TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) FeaturableModel(com.b3dgs.lionengine.game.feature.FeaturableModel) Featurable(com.b3dgs.lionengine.game.feature.Featurable)

Example 27 with MapTileGame

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();
}
Also used : TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) FeaturableModel(com.b3dgs.lionengine.game.feature.FeaturableModel) Featurable(com.b3dgs.lionengine.game.feature.Featurable) Identifiable(com.b3dgs.lionengine.game.feature.Identifiable) Test(org.junit.jupiter.api.Test)

Aggregations

MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)27 Media (com.b3dgs.lionengine.Media)11 MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)11 MapTile (com.b3dgs.lionengine.game.feature.tile.map.MapTile)10 Test (org.junit.jupiter.api.Test)10 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Featurable (com.b3dgs.lionengine.game.feature.Featurable)4 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)4 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)4 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)4 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)4 FileReading (com.b3dgs.lionengine.io.FileReading)4 Collection (java.util.Collection)4 Camera (com.b3dgs.lionengine.game.feature.Camera)3 FileWriting (com.b3dgs.lionengine.io.FileWriting)3 ViewerMock (com.b3dgs.lionengine.ViewerMock)2 Factory (com.b3dgs.lionengine.game.feature.Factory)2 Identifiable (com.b3dgs.lionengine.game.feature.Identifiable)2 Services (com.b3dgs.lionengine.game.feature.Services)2 MapTileTransitionModel (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransitionModel)2