Search in sources :

Example 1 with Transition

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

the class MapTileCircuitModel method updateTransitiveTile.

/**
 * Update tile.
 *
 * @param tile The tile reference.
 */
private void updateTransitiveTile(Tile tile) {
    final Circuit circuit = extractor.getCircuit(tile);
    if (circuit == null || !circuits.containsKey(circuit)) {
        final String group = getTransitiveGroup(circuit, tile);
        if (group != null) {
            final int old = tile.getNumber();
            final Integer ref = mapTransition.getTiles(new Transition(TransitionType.CENTER, group, group)).iterator().next();
            final Tile newTile = new TileGame(ref.intValue(), tile.getInTileX(), tile.getInTileY(), tile.getWidth(), tile.getHeight());
            map.setTile(newTile.getInTileX(), newTile.getInTileY(), newTile.getNumber());
            mapTransition.resolve(newTile);
            map.setTile(newTile.getInTileX(), newTile.getInTileY(), old);
        }
    }
}
Also used : Transition(com.b3dgs.lionengine.game.feature.tile.map.transition.Transition) GroupTransition(com.b3dgs.lionengine.game.feature.tile.map.transition.GroupTransition) MapTileTransition(com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition) Tile(com.b3dgs.lionengine.game.feature.tile.Tile) TileGame(com.b3dgs.lionengine.game.feature.tile.TileGame)

Aggregations

Tile (com.b3dgs.lionengine.game.feature.tile.Tile)1 TileGame (com.b3dgs.lionengine.game.feature.tile.TileGame)1 GroupTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.GroupTransition)1 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)1 Transition (com.b3dgs.lionengine.game.feature.tile.map.transition.Transition)1