Add Sound.Play overloads that play a random sound from a list
This commit is contained in:
@@ -327,10 +327,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.Add(projectile);
|
||||
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Any())
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition);
|
||||
|
||||
if (Burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Any())
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition);
|
||||
|
||||
foreach (var na in notifyAttacks)
|
||||
na.Attacking(self, target, this, barrel);
|
||||
@@ -356,12 +356,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Any())
|
||||
{
|
||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, () =>
|
||||
{
|
||||
Game.Sound.Play(SoundType.World, Weapon.AfterFireSound.Random(self.World.SharedRandom), self.CenterPosition);
|
||||
});
|
||||
}
|
||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, () => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
|
||||
foreach (var nbc in notifyBurstComplete)
|
||||
nbc.FiredBurst(self, target, this);
|
||||
|
||||
Reference in New Issue
Block a user