use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapTransitionExtractorTest method testDiagonalInverted.
/**
* Check the diagonal inverted transitions.
*/
@Test
void testDiagonalInverted() {
final MapTile map = UtilMap.createMap(9);
UtilMap.fill(map, TILE_WATER);
UtilMap.fill(map, TILE_GROUND, TILE_TRANSITION, 5, 3);
UtilMap.fill(map, TILE_GROUND, TILE_TRANSITION, 3, 5);
assertEquals(new Transition(TransitionType.UP_LEFT_DOWN_RIGHT, WATER, GROUND), get(map, 4, 4));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapTransitionExtractorTest method testVerticals.
/**
* Check the vertical transitions.
*/
@Test
void testVerticals() {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, TILE_WATER);
UtilMap.fill(map, TILE_GROUND, TILE_TRANSITION, 3);
assertEquals(new Transition(TransitionType.UP, WATER, GROUND), get(map, 3, 4));
assertEquals(new Transition(TransitionType.DOWN, WATER, GROUND), get(map, 3, 2));
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class TransitionsExtractorTest method testExtraction.
/**
* Test the transitions extraction.
*/
@Test
void testExtraction() {
final MapTile map = createMap(services, setup, 7);
UtilMap.fill(map, TILE_WATER);
UtilMap.fill(map, TILE_GROUND, TILE_TRANSITION, 3);
final MapTile map2 = createMap(services, setup, 7);
UtilMap.fill(map2, TILE_GROUND);
UtilMap.fill(map2, TILE_WATER, TILE_TRANSITION, 3);
final MapTile map3 = createMap(services, setup, 3);
final TransitionsExtractor extractor = new TransitionsExtractorImpl();
final Map<Transition, Collection<Integer>> transitions = extractor.getTransitions(Arrays.asList(map, map2, map3));
has(transitions, TransitionType.UP_LEFT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.UP_LEFT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.UP, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.UP, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.UP_RIGHT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.UP_RIGHT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.DOWN_LEFT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.DOWN_LEFT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.DOWN, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.DOWN, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.DOWN_RIGHT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.DOWN_RIGHT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.LEFT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.LEFT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.RIGHT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.RIGHT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_UP_LEFT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_UP_LEFT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_UP_RIGHT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_UP_RIGHT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_DOWN_LEFT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_DOWN_LEFT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_DOWN_RIGHT, WATER, GROUND, TILE_TRANSITION);
has(transitions, TransitionType.CORNER_DOWN_RIGHT, GROUND, WATER, TILE_TRANSITION);
has(transitions, TransitionType.CENTER, WATER, WATER, TILE_WATER);
has(transitions, TransitionType.CENTER, GROUND, GROUND, TILE_GROUND);
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.
the class MapCircuitExtractorTest method testBlock.
/**
* Check the block circuits.
*/
@Test
void testBlock() {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, TILE_GROUND);
map.setTile(3, 3, TILE_ROAD);
assertEquals(new Circuit(CircuitType.BLOCK, 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 testHorizontals.
/**
* Check the horizontal circuits.
*/
@Test
void testHorizontals() {
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);
assertEquals(new Circuit(CircuitType.LEFT, ROAD, GROUND), get(map, 2, 3));
assertEquals(new Circuit(CircuitType.HORIZONTAL, ROAD, GROUND), get(map, 3, 3));
assertEquals(new Circuit(CircuitType.RIGHT, ROAD, GROUND), get(map, 4, 3));
}
Aggregations