Skip to content
Snippets Groups Projects
Commit ddb3213b authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko
Browse files

#553 Removed vehicle sounds. Replaced with new ones.

parent 583d4ff9
No related branches found
No related tags found
No related merge requests found
Showing
with 26 additions and 53 deletions
File added
File deleted
File added
File deleted
File deleted
File deleted
File deleted
File added
File deleted
File deleted
......@@ -188,23 +188,14 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
@Override
protected void prepareGameSoundAssetNames(List<String> soundsFileNames) {
//Car Sounds
for(String carSound : PursuitAssets.SOUNDS_CAR) {
soundsFileNames.add(carSound);
}
//Train Sounds
for(String trainSound : PursuitAssets.SOUNDS_TRAIN) {
soundsFileNames.add(trainSound);
}
//Boat Sounds
for(String boatSound : PursuitAssets.SOUNDS_BOAT) {
soundsFileNames.add(boatSound);
}
//Motorcycle Sounds
for(String motorcycleSound : PursuitAssets.SOUNDS_MOTORCYCLE) {
soundsFileNames.add(motorcycleSound);
}
//Car Sound
soundsFileNames.add(PursuitAssets.SOUND_CAR);
//Train Sound
soundsFileNames.add(PursuitAssets.SOUND_TRAIN);
//Boat Sound
soundsFileNames.add(PursuitAssets.SOUND_BOAT);
//Motorcycle Sound
soundsFileNames.add(PursuitAssets.SOUND_MOTORCYCLE);
//Pieces Sounds
soundsFileNames.add(PursuitAssets.SOUND_LIFT);
soundsFileNames.add(PursuitAssets.SOUND_ROTATION);
......@@ -450,39 +441,32 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
}
/**
* Returns all Sounds (instances of Music) for vehicleType
* Returns sound (instances of Music) for vehicleType
* @param vehicleType
* @return Music vehicle sounds
* @return Music vehicle sound
*/
private Music[] getVehicleSounds(VehicleType vehicleType) {
private Music getVehicleSound(VehicleType vehicleType) {
//Using music, so i can use OnCompletionListener
Music[] result;
String[] soundsToLoad;
String soundsToLoad;
switch (vehicleType) {
case CAR:
soundsToLoad = PursuitAssets.SOUNDS_CAR;
soundsToLoad = PursuitAssets.SOUND_CAR;
break;
case MOTORCYCLE:
soundsToLoad = PursuitAssets.SOUNDS_MOTORCYCLE;
soundsToLoad = PursuitAssets.SOUND_MOTORCYCLE;
break;
case TRAIN:
soundsToLoad = PursuitAssets.SOUNDS_TRAIN;
soundsToLoad = PursuitAssets.SOUND_TRAIN;
break;
case BOAT:
soundsToLoad = PursuitAssets.SOUNDS_BOAT;
soundsToLoad = PursuitAssets.SOUND_BOAT;
break;
default:
throw new IllegalArgumentException(this.getClass().getSimpleName() + ": Can't get sounds for vehicleType: " + vehicleType);
}
result = new Music[soundsToLoad.length];
for(int i = 0; i < soundsToLoad.length; i++) {
result[i] = getMusic(soundsToLoad[i]);
}
return result;
return getMusic(soundsToLoad);
}
//sets the position according to completed map rotation
......@@ -504,16 +488,14 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
finishFlag.setVisible(true);
final Music[] vehicleSounds = getVehicleSounds(TextureHelper.getVehicleTextureName(getRandom(), mapNumber));
final Music vehicleSound = getVehicleSound(TextureHelper.getVehicleTextureName(getRandom(), mapNumber));
final CatmullRomSpline<Vector2> path = new CatmullRomSpline<Vector2>(PursuitPositionDefinition.getPointsWithRotation(PursuitPositionDefinition.values()[mapNumber],grid.getRotation()),false);
VehicleMoveAction vehicleMoveAlongAction = new VehicleMoveAction(path, ANIMATION_MOVING_DURATION, grid.getWidth(), vehicleSounds[getRandom().nextInt(vehicleSounds.length)]);
VehicleMoveAction vehicleMoveAlongAction = new VehicleMoveAction(path, ANIMATION_MOVING_DURATION, grid.getWidth(), vehicleSound);
vehicle.addAction(Actions.sequence(Actions.show(),Actions.delay(ANIMATION_DELAY_DURATION),vehicleMoveAlongAction,new RunnableAction() {
@Override
public void run() {
for(Music snd : vehicleSounds) {
snd.stop();
snd.dispose();
}
vehicleSound.stop();
vehicleSound.dispose();
endGame();
showGameResultDialog();
vehicle.clear();
......
......@@ -18,20 +18,11 @@ public class PursuitAssets {
public static final String SOUND_SWITCH = SOUNDS_PATH+"switch"+MP3_EXTENSION;
public static final String SOUND_LIFT = SOUNDS_PATH+"lift"+MP3_EXTENSION;
//VEHICLE SOUNDS
public static final String[] SOUNDS_CAR = { SOUNDS_PATH + "car_1" + MP3_EXTENSION,
SOUNDS_PATH + "car_2" + MP3_EXTENSION,
SOUNDS_PATH + "car_3" + MP3_EXTENSION,
SOUNDS_PATH + "car_4" + MP3_EXTENSION,
};
public static final String[] SOUNDS_TRAIN = { SOUNDS_PATH + "train_1" + MP3_EXTENSION,
SOUNDS_PATH + "train_2" + MP3_EXTENSION
};
public static final String[] SOUNDS_BOAT = { SOUNDS_PATH + "boat_1" + MP3_EXTENSION};
public static final String[] SOUNDS_MOTORCYCLE = { SOUNDS_PATH + "motorcycle_1" + MP3_EXTENSION};
//VEHICLE SOUNDS
public static final String SOUND_CAR = SOUNDS_PATH + "car" + MP3_EXTENSION;
public static final String SOUND_TRAIN = SOUNDS_PATH + "train" + MP3_EXTENSION;
public static final String SOUND_BOAT = SOUNDS_PATH + "boat" + MP3_EXTENSION;
public static final String SOUND_MOTORCYCLE = SOUNDS_PATH + "motorcycle" + MP3_EXTENSION;
//OTHER SOUNDS
public static final String SOUND_HELP = SOUNDS_PATH+"help"+MP3_EXTENSION;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment