summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-22 22:57:25 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-22 22:57:25 +0100
commitf3e66547b54f1721b23fdc771c9dbf1f38c757ef (patch)
tree18e7b07c643705972b0ae234bdb59c228e943b97
parentaec9aa6c1aafb2c936b50b07d856c077ee09c3a8 (diff)
downloadRustAndDust-f3e66547b54f1721b23fdc771c9dbf1f38c757ef.zip
RustAndDust-f3e66547b54f1721b23fdc771c9dbf1f38c757ef.tar.gz
Map,SoundAnimation: use config.fxVolume
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java8
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java6
2 files changed, 8 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java
index aaa7787..797b09b 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java
@@ -16,6 +16,7 @@ public class SoundAnimation extends TimedAnimation
private Sound sound;
private long soundId;
private Action action;
+ private float volume;
private static final Pool<SoundAnimation> soundAnimationPool = new Pool<SoundAnimation>() {
@Override
@@ -24,13 +25,14 @@ public class SoundAnimation extends TimedAnimation
}
};
- public static SoundAnimation get(Action action, Sound sound, long soundId, float duration)
+ public static SoundAnimation get(Action action, Sound sound, long soundId, float volume, float duration)
{
SoundAnimation a = soundAnimationPool.obtain();
a.action = action;
a.sound = sound;
a.soundId = soundId;
+ a.volume = volume;
a.duration = duration;
return a;
@@ -59,11 +61,11 @@ public class SoundAnimation extends TimedAnimation
float v;
switch(action) {
case FADE_IN:
- v = ( 1.0f * percent);
+ v = ( volume * percent);
sound.setVolume(soundId, v);
break;
case FADE_OUT:
- v = (1.0f - ( 1.0f * percent));
+ v = (volume - ( volume * percent));
sound.setVolume(soundId, v);
break;
}
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index f78e499..94ba334 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -242,7 +242,7 @@ public abstract class Map extends Board
moveableUnits.remove(unit);
activatedUnits.add(unit);
sound = moveSound;
- soundId = sound.play(1.0f);
+ soundId = sound.play(ctrl.cfg.fxVolume);
return moveableUnits.size();
}
@@ -260,7 +260,7 @@ public abstract class Map extends Board
{
TankOnTank.debug("animation done");
if (soundId >= 0)
- addAnimation( SoundAnimation.get(SoundAnimation.Action.FADE_OUT, sound, soundId, 0.5f));
+ addAnimation( SoundAnimation.get(SoundAnimation.Action.FADE_OUT, sound, soundId, ctrl.cfg.fxVolume, 0.5f));
soundId = -1;
ctrl.animationDone();
}
@@ -335,7 +335,7 @@ public abstract class Map extends Board
seq.addAnimation(notifyDoneAnimation(target));
addAnimation(seq);
sound = engagementSound;
- sound.play(1.0f);
+ sound.play(ctrl.cfg.fxVolume);
}
public boolean engageUnit(Unit unit, final Unit target)