/* Provides a means to play a from selection random sounds, but lock to one sound per frame and boost it's volume for multiple calls */ public void addRandom(String key, Array <string> choices, double volume = 1.0) { if (groups.ContainsKey(key) == false) { groups[key] = choices[(int)((Math.random() * choices.length)) >> 0]; } add(groups[key], volume); }
/* Play a random sound immediately instead of waiting for the update */ public void playRandom(Array <string> choices, double volume = 1.0) { var key = choices[(int)((Math.random() * choices.length)) >> 0]; SoundManager.playSound(key, volume); }