Commit b93fb246 authored by Aneta Steimarova's avatar Aneta Steimarova

#865 Made dilay after play each sound in sequence bonus

parent baed8ac9
......@@ -57,6 +57,7 @@ public class SequenceGenerator extends Group {
private static final Color NORMAL_COLOR = Color.BLACK;
private static final float SILENCE_DELAY = 2f;
private static final float SEQUENCE_DELAY = 1f;
private static final float BONUS_DELAY = 0.75f;
private Image earImage, backgroundImage;
private TablexiaLabel text;
......@@ -114,13 +115,13 @@ public class SequenceGenerator extends Group {
int charNum = 0;
//generated sequence
for (SafeSounds safeSequenceSound : safeSequence.getGeneratedSoundSequence()) {
charNum = addSound(sa, safeSequenceSound, charNum, listOfChars, playMusicActionList, safeSequence);
charNum = addSound(sa, safeSequenceSound, charNum, listOfChars, playMusicActionList, safeSequence, safegame);
}
//repeat first x sounds
for (int i = 0; i < safeSequence.getPlayAgainFirstXSounds(); i++) {
SafeSounds safeSound = safeSequence.getGeneratedSoundSequence()[i];
charNum = addSound(sa, safeSound, charNum, listOfChars, playMusicActionList, safeSequence);
charNum = addSound(sa, safeSound, charNum, listOfChars, playMusicActionList, safeSequence, safegame);
}
Log.info("Sequence Generator", soundSequence);
return sa;
......@@ -140,23 +141,23 @@ public class SequenceGenerator extends Group {
}
private static int addSound(SequenceAction sa, SafeSounds safeSequenceSound, int charNum, List<Actor> listOfChars, List<Action> playMusicActionList, SafeSequence safeSequence) {
private static int addSound(SequenceAction sa, SafeSounds safeSequenceSound, int charNum, List<Actor> listOfChars, List<Action> playMusicActionList, SafeSequence safeSequence, SafeGame safegame) {
if (safeSequenceSound.equals(SafeSounds.SILENCE)) {
sa.addAction(Actions.delay(SILENCE_DELAY));
soundSequence += " - ";
} else {
soundSequence += safeSequenceSound.toString() + " ";
if (listOfChars != null)
addActionToSequence(safeSequenceSound, sa, playMusicActionList, safeSequence, listOfChars.get(charNum));
addActionToSequence(safeSequenceSound, sa, playMusicActionList, safeSequence, listOfChars.get(charNum), safegame);
else
addActionToSequence(safeSequenceSound, sa, playMusicActionList, safeSequence, null);
addActionToSequence(safeSequenceSound, sa, playMusicActionList, safeSequence, null, safegame);
charNum++;
}
return charNum;
}
private static void addActionToSequence(SafeSounds safeSequenceSound, SequenceAction sa, List<Action> playMusicActionList, SafeSequence safeSequence, Actor character) {
private static void addActionToSequence(SafeSounds safeSequenceSound, SequenceAction sa, List<Action> playMusicActionList, SafeSequence safeSequence, Actor character, SafeGame safegame) {
Action playMusicAction = findActionForSafeSound(safeSequenceSound, playMusicActionList, safeSequence);
if (playMusicAction == null)
Log.err("ERROR", "Well...this should not happen. Try to look at addActionToSequence method in SequenceGenerator.");
......@@ -175,6 +176,9 @@ public class SequenceGenerator extends Group {
}
}));
sa.addAction(playMusicAction);
if (safegame.getGameDifficulty().equals(GameDifficulty.BONUS)){
sa.addAction(Actions.delay(BONUS_DELAY));
}
if (character != null) {
sa.addAction(Actions.run(new Runnable() {
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment