Cleaned up IVoiced-related code.

Added Volume control and descriptions to Voiced.

Streamline voice checks in WorldUtils and DeathSounds.
This commit is contained in:
reaperrr
2015-05-14 17:48:35 +02:00
parent 251d3e6864
commit 5f68516070
8 changed files with 57 additions and 73 deletions

View File

@@ -40,13 +40,10 @@ namespace OpenRA.Mods.Common.Traits
if (e.Warhead == null)
return;
var cp = self.CenterPosition;
foreach (var voiced in self.TraitsImplementing<IVoiced>())
if (info.DeathTypes.Contains(e.Warhead.DeathType) ||
(!info.DeathTypes.Any() && !self.Info.Traits.WithInterface<DeathSoundsInfo>()
.Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
voiced.PlayVoiceLocal(info.DeathSound, self, self.Owner.Country.Race, cp, info.VolumeMultiplier);
if (info.DeathTypes.Contains(e.Warhead.DeathType) || (!info.DeathTypes.Any() &&
!self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
foreach (var voiced in self.TraitsImplementing<IVoiced>())
voiced.PlayVoiceLocal(self, info.DeathSound, self.Owner.Country.Race, info.VolumeMultiplier);
}
}
}