Moved Voice-related extensions to VoiceExts.

Note: This is a work-around until Selectable can be moved to Mods.Common, which is when the voice extensions should be moved back to ActorExts.

Pulled phrase check before foreach in PlayVoice ActorExts.
Removed superflous actor parameter from PlayVoice/PlayVoiceLocal.

Simplified PlayVoice extensions.

variant is no longer customisable, as all current usages use self.Owner.Country.Race anyway.
This commit is contained in:
reaperrr
2015-05-21 15:48:30 +02:00
parent b9e8406aeb
commit 3777a8bca9
8 changed files with 80 additions and 58 deletions

View File

@@ -80,39 +80,6 @@ namespace OpenRA.Mods.Common
return Target.Invalid;
}
public static void PlayVoice(this Actor self, Actor actor, string phrase, string variant)
{
foreach (var voiced in self.TraitsImplementing<IVoiced>())
{
if (phrase == null)
return;
if (string.IsNullOrEmpty(voiced.VoiceSet))
return;
voiced.PlayVoice(self, phrase, variant);
}
}
public static void PlayVoiceLocal(this Actor self, Actor actor, string phrase, string variant, float volume)
{
foreach (var voiced in self.TraitsImplementing<IVoiced>())
{
if (phrase == null)
return;
if (string.IsNullOrEmpty(voiced.VoiceSet))
return;
voiced.PlayVoiceLocal(self, phrase, variant, volume);
}
}
public static bool HasVoice(this Actor self, string voice)
{
return self.TraitsImplementing<IVoiced>().Any(x => x.HasVoice(self, voice));
}
public static void NotifyBlocker(this Actor self, IEnumerable<Actor> blockers)
{
foreach (var blocker in blockers)