add audio feedback to stop/scatter/deploy junk

This commit is contained in:
Chris Forbes
2011-03-06 10:22:40 +13:00
parent 1a6ff61836
commit 65a54ba13a
3 changed files with 36 additions and 18 deletions

View File

@@ -124,6 +124,19 @@ namespace OpenRA
if (!a.Info.Traits.Contains<SelectableInfo>()) return null;
var v = a.Info.Traits.Get<SelectableInfo>().Voice;
return (v == null) ? null : Rules.Voices[v];
}
public static void PlayVoiceForOrders(this World w, Order[] orders)
{
// Find an actor with a phrase to say
foreach (var o in orders)
{
if (o.Subject.Destroyed) continue;
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o),
o.Subject, o.Subject.Owner.Country.Race))
return;
}
}
}
}