use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class TransitionsConfig method exportTiles.
/**
* Export all tiles for the transition.
*
* @param nodeTransition The transition node (must not be <code>null</code>).
* @param tilesRef The transition tiles ref (must not be <code>null</code>).
*/
private static void exportTiles(Xml nodeTransition, Collection<TileRef> tilesRef) {
for (final TileRef tileRef : tilesRef) {
final Xml nodeTileRef = TileConfig.exports(tileRef);
nodeTransition.add(nodeTileRef);
}
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class TransitionsExtractorImpl method checkTransition.
/**
* Check the tile transition and add it to transitions collection if valid.
*
* @param transitions The transitions collection.
* @param extractor The transition extractor.
* @param tile The tile to check.
*/
private static void checkTransition(Map<Transition, Collection<TileRef>> transitions, MapTransitionExtractor extractor, Tile tile) {
final Transition transition = extractor.getTransition(tile);
if (transition != null) {
getTiles(transitions, transition).add(new TileRef(tile));
final Transition symetric = new Transition(transition.getType().getSymetric(), transition.getOut(), transition.getIn());
getTiles(transitions, symetric).add(new TileRef(tile));
}
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class TransitionsExtractorTest method has.
/**
* Check the transition with tile.
*
* @param transitions The transitions found.
* @param type The transition type.
* @param in The group in.
* @param out The group out.
* @param number The tile number.
*/
private void has(Map<Transition, Collection<TileRef>> transitions, TransitionType type, String in, String out, int number) {
final Transition transition = new Transition(type, in, out);
final TileRef tile = new TileRef(SHEET, number);
Assert.assertTrue(transitions.get(transition).contains(tile));
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class CircuitsExtractorImpl method checkCircuit.
/**
* Check the tile circuit and add it to circuits collection if valid.
*
* @param circuits The circuits collection.
* @param extractor The circuit extractor.
* @param map The map reference.
* @param tile The tile to check.
*/
private static void checkCircuit(Map<Circuit, Collection<TileRef>> circuits, MapCircuitExtractor extractor, MapTile map, Tile tile) {
final Circuit circuit = extractor.getCircuit(tile);
if (circuit != null) {
final TileRef ref = new TileRef(tile);
getTiles(circuits, circuit).add(ref);
checkTransitionGroups(circuits, circuit, map, ref);
}
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class MapTileGroupModel method loadGroups.
/*
* MapTileGroup
*/
@Override
public void loadGroups(Media groupsConfig) {
this.groupsConfig = groupsConfig;
groupTiles.clear();
tilesGroup.clear();
groupTypes.clear();
for (final TileGroup group : TileGroupsConfig.imports(groupsConfig)) {
final String name = group.getName();
groupTiles.put(name, group.getTiles());
groupTypes.put(name, group.getType());
for (final TileRef tile : group.getTiles()) {
tilesGroup.put(tile, name);
}
}
}
Aggregations