use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapCircuitExtractorTest method testCircuitMiddle.
/**
* Check the middle circuit.
*/
@Test
void testCircuitMiddle() {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, TILE_GROUND);
UtilMap.fill(map, TILE_ROAD, TILE_ROAD, 3);
assertEquals(new Circuit(CircuitType.MIDDLE, ROAD, ROAD), get(map, 3, 3));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapCircuitExtractorTest method testT3JTop.
/**
* Check the three way junction top circuits.
*/
@Test
void testT3JTop() {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, TILE_GROUND);
map.setTile(2, 3, TILE_ROAD);
map.setTile(3, 3, TILE_ROAD);
map.setTile(4, 3, TILE_ROAD);
map.setTile(3, 2, TILE_ROAD);
assertEquals(new Circuit(CircuitType.T3J_TOP, ROAD, GROUND), get(map, 3, 3));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapCircuitExtractorTest method testVerticals.
/**
* Check the vertical circuits.
*/
@Test
void testVerticals() {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, TILE_GROUND);
map.setTile(3, 2, TILE_ROAD);
map.setTile(3, 3, TILE_ROAD);
map.setTile(3, 4, TILE_ROAD);
assertEquals(new Circuit(CircuitType.TOP, ROAD, GROUND), get(map, 3, 4));
assertEquals(new Circuit(CircuitType.VERTICAL, ROAD, GROUND), get(map, 3, 3));
assertEquals(new Circuit(CircuitType.BOTTOM, ROAD, GROUND), get(map, 3, 2));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapCircuitExtractorTest method testNullNeighbor.
/**
* Check the circuit with <code>null</code> neighbors.
*/
@Test
void testNullNeighbor() {
final MapTile map = UtilMap.createMap(7);
map.setTile(4, 2, TILE_ROAD);
map.setTile(3, 3, TILE_ROAD);
assertNull(get(map, 3, 3));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class UtilMapCircuit method createCircuits.
/**
* Create map with circuits.
*
* @param configTransition The transition configuration.
* @return The created configuration.
*/
public static Media createCircuits(Media configTransition) {
final MapTile map1 = UtilMap.createMap(6);
map1.getFeature(MapTileTransition.class).loadTransitions(configTransition);
UtilMap.fill(map1, TILE_GROUND);
map1.setTile(1, 2, TILE_ROAD);
map1.setTile(2, 3, TILE_ROAD);
map1.setTile(2, 1, TILE_ROAD);
map1.setTile(2, 2, TILE_ROAD);
map1.setTile(3, 2, TILE_ROAD);
map1.setTile(5, 5, TILE_ROAD);
final MapTile map2 = UtilMap.createMap(5);
map2.getFeature(MapTileTransition.class).loadTransitions(configTransition);
UtilMap.fill(map2, TILE_GROUND);
map2.setTile(1, 1, TILE_ROAD);
map2.setTile(1, 2, TILE_ROAD);
map2.setTile(1, 3, TILE_ROAD);
map2.setTile(2, 1, TILE_ROAD);
map2.setTile(2, 2, TILE_ROAD);
map2.setTile(2, 3, TILE_ROAD);
map2.setTile(3, 1, TILE_ROAD);
map2.setTile(3, 2, TILE_ROAD);
map2.setTile(3, 3, TILE_ROAD);
final MapTile map3 = UtilMap.createMap(10);
map3.getFeature(MapTileTransition.class).loadTransitions(configTransition);
UtilMap.fill(map3, TILE_GROUND);
map3.setTile(1, 2, TILE_ROAD);
map3.setTile(2, 2, TILE_ROAD);
map3.setTile(3, 2, TILE_ROAD);
map3.setTile(2, 1, TILE_ROAD);
map3.setTile(1, 5, TILE_ROAD);
map3.setTile(2, 5, TILE_ROAD);
map3.setTile(3, 5, TILE_ROAD);
map3.setTile(2, 6, TILE_ROAD);
map3.setTile(5, 6, TILE_ROAD);
map3.setTile(5, 7, TILE_ROAD);
map3.setTile(5, 8, TILE_ROAD);
map3.setTile(6, 5, TILE_ROAD);
map3.setTile(5, 6, TILE_ROAD);
map3.setTile(5, 7, TILE_ROAD);
map3.setTile(5, 8, TILE_ROAD);
map3.setTile(6, 9, TILE_ROAD);
final Media config = Medias.create("circuits.xml");
CircuitsConfig.exports(config, new CircuitsExtractorImpl().getCircuits(Arrays.asList(map1, map2, map3)));
return config;
}
Aggregations