Search in sources :

Example 56 with MapTile

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

the class TransitionsExtractorImpl method getTransitions.

/*
     * TransitionsExtractor
     */
@Override
public Map<Transition, Collection<Integer>> getTransitions(Collection<Media> levels, Media sheetsConfig, Media groupsConfig) {
    final Collection<MapTile> mapsSet = new HashSet<>(levels.size());
    for (final Media level : levels) {
        final MapTileGame map = new MapTileGame();
        map.create(level, sheetsConfig);
        final MapTileGroup mapGroup = new MapTileGroupModel();
        mapGroup.loadGroups(groupsConfig);
        map.addFeature(mapGroup);
        mapsSet.add(map);
    }
    return getTransitions(mapsSet);
}
Also used : MapTileGroup(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) Media(com.b3dgs.lionengine.Media) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) HashSet(java.util.HashSet)

Example 57 with MapTile

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

the class TransitionsExtractorImpl method getTransitions.

/**
 * Get map tile transitions.
 *
 * @param map The map reference.
 * @return The transitions found with their associated tiles.
 */
private static Map<Transition, Collection<Integer>> getTransitions(MapTile map) {
    final Map<Transition, Collection<Integer>> transitions = new HashMap<>();
    final MapTransitionExtractor extractor = new MapTransitionExtractor(map);
    for (int ty = 1; ty < map.getInTileHeight() - 1; ty++) {
        for (int tx = 1; tx < map.getInTileWidth() - 1; tx++) {
            final Tile tile = map.getTile(tx, ty);
            if (tile != null) {
                checkTransition(transitions, extractor, tile);
            }
        }
    }
    return transitions;
}
Also used : HashMap(java.util.HashMap) Collection(java.util.Collection) MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Tile(com.b3dgs.lionengine.game.feature.tile.Tile)

Example 58 with MapTile

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

the class CircuitsExtractorImpl method getCircuits.

/*
     * CircuitsExtractor
     */
@Override
public Map<Circuit, Collection<Integer>> getCircuits(Collection<Media> levels, Media sheetsConfig, Media groupsConfig) {
    final Collection<MapTile> mapsSet = new HashSet<>(levels.size());
    for (final Media level : levels) {
        final MapTileGame map = new MapTileGame();
        map.create(level, sheetsConfig);
        final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
        final MapTileTransition mapTransition = map.addFeatureAndGet(new MapTileTransitionModel());
        mapGroup.loadGroups(groupsConfig);
        mapTransition.loadTransitions(levels, sheetsConfig, groupsConfig);
        mapsSet.add(map);
    }
    return getCircuits(mapsSet);
}
Also used : MapTileGroup(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileTransition(com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition) Media(com.b3dgs.lionengine.Media) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) MapTileTransitionModel(com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransitionModel) MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) HashSet(java.util.HashSet)

Aggregations

MapTile (com.b3dgs.lionengine.game.feature.tile.map.MapTile)58 Test (org.junit.jupiter.api.Test)34 Media (com.b3dgs.lionengine.Media)15 Tile (com.b3dgs.lionengine.game.feature.tile.Tile)11 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)10 Collection (java.util.Collection)9 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)8 MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)7 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)4 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)3 Setup (com.b3dgs.lionengine.game.feature.Setup)3 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)3 Featurable (com.b3dgs.lionengine.game.feature.Featurable)2 Transformable (com.b3dgs.lionengine.game.feature.Transformable)2 UtilTransformable (com.b3dgs.lionengine.game.feature.UtilTransformable)2 FileReading (com.b3dgs.lionengine.io.FileReading)2 FileWriting (com.b3dgs.lionengine.io.FileWriting)2 HashSet (java.util.HashSet)2