use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class MapTileTransitionModel method loadTransitions.
@Override
public void loadTransitions(Map<Transition, Collection<TileRef>> transitions) {
this.transitions.clear();
this.transitions.putAll(transitions);
tiles.clear();
for (final Entry<Transition, Collection<TileRef>> entry : this.transitions.entrySet()) {
final Transition transition = entry.getKey();
for (final TileRef tileRef : entry.getValue()) {
if (!tiles.containsKey(tileRef)) {
tiles.put(tileRef, new HashSet<Transition>());
}
tiles.get(tileRef).add(transition);
}
groupLinks.add(new GroupTransition(transition.getIn(), transition.getOut()));
groupLinks.add(new GroupTransition(transition.getOut(), transition.getIn()));
}
transitiveGroup = new TransitiveGroup(map);
transitiveGroup.load();
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class CircuitsConfig method exportTiles.
/**
* Export all tiles for the circuit.
*
* @param nodeCircuit The circuit node (must not be <code>null</code>).
* @param tilesRef The circuit tiles ref.
*/
private static void exportTiles(Xml nodeCircuit, Collection<TileRef> tilesRef) {
for (final TileRef tileRef : tilesRef) {
final Xml nodeTileRef = TileConfig.exports(tileRef);
nodeCircuit.add(nodeTileRef);
}
}
use of com.b3dgs.lionengine.game.feature.tile.TileRef in project lionengine by b3dgs.
the class MapTileGroupModelTest method testCustom.
/**
* Test the map tile with custom group.
*/
@Test
public void testCustom() {
mapGroup.changeGroup(tile, "water");
Assert.assertEquals(new TileRef(tile), mapGroup.getGroup("water").iterator().next());
Assert.assertEquals("water", mapGroup.getGroup(tile));
Assert.assertEquals("water", mapGroup.getGroup(new TileRef(0, 0)));
Assert.assertEquals("water", mapGroup.getGroup(Integer.valueOf(0), 0));
Assert.assertTrue(mapGroup.getGroups().containsAll(Arrays.asList("water")));
mapGroup.changeGroup(tile, "tree");
Assert.assertEquals(new TileRef(tile), mapGroup.getGroup("tree").iterator().next());
Assert.assertEquals("tree", mapGroup.getGroup(tile));
Assert.assertEquals("tree", mapGroup.getGroup(new TileRef(0, 0)));
Assert.assertEquals("tree", mapGroup.getGroup(Integer.valueOf(0), 0));
Assert.assertTrue(mapGroup.getGroups().containsAll(Arrays.asList("water", "tree")));
mapGroup.changeGroup(tile, null);
Assert.assertFalse(mapGroup.getGroup(MapTileGroupModel.NO_GROUP_NAME).iterator().hasNext());
Assert.assertEquals(MapTileGroupModel.NO_GROUP_NAME, mapGroup.getGroup(tile));
Assert.assertEquals(MapTileGroupModel.NO_GROUP_NAME, mapGroup.getGroup(new TileRef(0, 0)));
Assert.assertEquals(MapTileGroupModel.NO_GROUP_NAME, mapGroup.getGroup(Integer.valueOf(0), 0));
}
Aggregations