Add an Unload voice for when a unit is unloading.

This commit is contained in:
ScottNZ
2013-07-22 22:19:37 +12:00
parent 80ebd3aae1
commit dc84acc300
3 changed files with 11 additions and 5 deletions

View File

@@ -151,18 +151,24 @@ namespace OpenRA
return new float2(Gauss1D(r, samples), Gauss1D(r, samples));
}
public static bool HasVoice(this Actor a)
public static bool HasVoices(this Actor a)
{
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();
return selectable != null && selectable.Voice != null;
}
public static SoundInfo GetVoice(this Actor a)
public static bool HasVoice(this Actor a, string voice)
{
var v = GetVoices(a);
return v != null && v.Voices.ContainsKey(voice);
}
public static SoundInfo GetVoices(this Actor a)
{
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();
if (selectable == null) return null;
var v = selectable.Voice;
return (v == null) ? null : Rules.Voices[v];
return (v == null) ? null : Rules.Voices[v.ToLowerInvariant()];
}
public static void PlayVoiceForOrders(this World w, Order[] orders)