mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
play(String,boolean) will now select a random file from the group (if any)
This commit is contained in:
parent
d82a3005c2
commit
2615bbcb86
@ -5,6 +5,7 @@ import com.badlogic.gdx.assets.AssetDescriptor;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.audio.Music;
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
import com.badlogic.gdx.utils.Pools;
|
||||
@ -128,6 +129,11 @@ public class Audio {
|
||||
if (id.isEmpty()) return null;
|
||||
Sounds.Entry sound = Riiablo.files.Sounds.get(id);
|
||||
if (sound == null) return null;
|
||||
if (sound.Group_Size > 0) {
|
||||
int randomId = sound.Index + MathUtils.random.nextInt(sound.Group_Size);
|
||||
sound = Riiablo.files.Sounds.get(randomId);
|
||||
}
|
||||
|
||||
return play(sound, global);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user