Move PlayVoice and PlayVoiceLocal from Sound to Voiced.
Move HasVoice, HasVoices and GetVoices from WorldUtils to Voiced.
This commit is contained in:
@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public void BuildingComplete(Actor self)
|
||||
{
|
||||
Sound.PlayVoice("Build", self, self.Owner.Country.Race);
|
||||
foreach (var voiced in self.TraitsImplementing<IVoiced>())
|
||||
voiced.PlayVoice("Build", self, self.Owner.Country.Race);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
|
||||
{
|
||||
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
foreach (var voiced in self.TraitsImplementing<IVoiced>())
|
||||
voiced.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
|
||||
lastAnnounce = self.World.WorldTick;
|
||||
}
|
||||
|
||||
@@ -42,9 +42,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var cp = self.CenterPosition;
|
||||
|
||||
if (info.DeathTypes.Contains(e.Warhead.DeathType) ||
|
||||
(!info.DeathTypes.Any() && !self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
|
||||
Sound.PlayVoiceLocal(info.DeathSound, self, self.Owner.Country.Race, cp, info.VolumeMultiplier);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user