Search in sources :

Example 6 with MapTileGroupModel

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.

the class MapTileCollisionModelTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    map.addFeature(new MapTileGroupModel());
    map.create(1, 1, 3, 3);
    UtilMap.setGroups(map);
    UtilMap.fill(map, UtilMap.TILE_GROUND);
    mapCollision = map.addFeatureAndGet(new MapTileCollisionModel());
    mapCollision.prepare(map);
    formulasConfig = UtilConfig.createFormulaConfig(formulaV, formulaH);
    groupsConfig = UtilConfig.createGroupsConfig(group);
    mapCollision.loadCollisions(formulasConfig, groupsConfig);
    transformable = createObject();
}
Also used : MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with MapTileGroupModel

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.

the class CollisionCategoryConfigTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTileGroupModel());
    mapCollision = new MapTileCollisionModel();
    mapCollision.prepare(map);
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with MapTileGroupModel

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.

the class MapTilePathModelTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    services.add(new Camera());
    map.addFeature(new MapTileGroupModel());
    map.create(1, 1, 7, 7);
    UtilMap.setGroups(map);
    UtilMap.fill(map, UtilMap.TILE_GROUND);
    mapPath = map.addFeatureAndGet(new MapTilePathModel());
    mapPath.prepare(map);
    mapPath.loadPathfinding(Medias.create("pathfinding.xml"));
}
Also used : MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) Camera(com.b3dgs.lionengine.game.feature.Camera) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with MapTileGroupModel

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.

the class AstarTest method testCreatePathFinder.

/**
 * Test the create path finder.
 */
@Test
void testCreatePathFinder() {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTileGroupModel());
    map.addFeature(new MapTilePathModel());
    assertNotNull(Astar.createPathFinder(map, 1, new HeuristicClosest()));
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) Test(org.junit.jupiter.api.Test)

Example 10 with MapTileGroupModel

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.

the class TransitionsConfigTest method testExportsImports.

/**
 * Test exports and imports.
 *
 * @throws IOException If error.
 */
@Test
void testExportsImports() throws IOException {
    final MapTile map = UtilMap.createMap(7);
    UtilMap.fill(map, UtilMap.TILE_WATER);
    UtilMap.fill(map, UtilMap.TILE_WATER, UtilMap.TILE_TRANSITION, 3);
    final MapTile map2 = UtilMap.createMap(7);
    UtilMap.fill(map, UtilMap.TILE_WATER);
    UtilMap.fill(map, UtilMap.TILE_GROUND, UtilMap.TILE_TRANSITION, 3);
    final MapTileGame map3 = new MapTileGame();
    map3.addFeature(new MapTileGroupModel());
    map3.create(1, 1, 3, 3);
    final TransitionsExtractor extractor = new TransitionsExtractorImpl();
    final Map<Transition, Collection<Integer>> transitions = extractor.getTransitions(Arrays.asList(map, map2, map3));
    final Media media = Medias.create("transition.xml");
    TransitionsConfig.exports(media, transitions);
    assertEquals(transitions, TransitionsConfig.imports(media));
    assertTrue(media.getFile().delete());
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) Media(com.b3dgs.lionengine.Media) Collection(java.util.Collection) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Test(org.junit.jupiter.api.Test)

Aggregations

MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)19 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)11 Media (com.b3dgs.lionengine.Media)9 MapTile (com.b3dgs.lionengine.game.feature.tile.map.MapTile)7 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)4 MapTileTransitionModel (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransitionModel)4 Collection (java.util.Collection)4 Camera (com.b3dgs.lionengine.game.feature.Camera)3 MapTileCircuitModel (com.b3dgs.lionengine.game.feature.tile.map.transition.circuit.MapTileCircuitModel)3 MapTileViewerModel (com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewerModel)3 Test (org.junit.Test)3 Test (org.junit.jupiter.api.Test)3 Factory (com.b3dgs.lionengine.game.feature.Factory)2 Featurable (com.b3dgs.lionengine.game.feature.Featurable)2 Transformable (com.b3dgs.lionengine.game.feature.Transformable)2 MapTilePathModel (com.b3dgs.lionengine.game.feature.tile.map.pathfinding.MapTilePathModel)2 Pathfindable (com.b3dgs.lionengine.game.feature.tile.map.pathfinding.Pathfindable)2 HashSet (java.util.HashSet)2