Add Sound.Play overloads that play a random sound from a list

This commit is contained in:
abcdefg30
2019-04-07 23:20:20 +02:00
committed by reaperrr
parent 5f6c8ba5d3
commit 1bb319425b
15 changed files with 27 additions and 22 deletions

View File

@@ -147,6 +147,16 @@ namespace OpenRA
public ISound PlayLooped(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f, true); }
public ISound PlayLooped(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f, true); }
public ISound Play(SoundType type, string[] names, World world, Player player = null, float volumeModifier = 1f)
{
return Play(type, player, names.Random(world.LocalRandom), true, WPos.Zero, volumeModifier);
}
public ISound Play(SoundType type, string[] names, World world, WPos pos, Player player = null, float volumeModifier = 1f)
{
return Play(type, player, names.Random(world.LocalRandom), false, pos, volumeModifier);
}
public void PlayVideo(byte[] raw, int channels, int sampleBits, int sampleRate)
{
StopVideo();