summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
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 /core/src/ch/asynk/tankontank/engine
parentaec9aa6c1aafb2c936b50b07d856c077ee09c3a8 (diff)
downloadRustAndDust-f3e66547b54f1721b23fdc771c9dbf1f38c757ef.zip
RustAndDust-f3e66547b54f1721b23fdc771c9dbf1f38c757ef.tar.gz
Map,SoundAnimation: use config.fxVolume
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/SoundAnimation.java8
1 files changed, 5 insertions, 3 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;
}