add audio feedback to stop/scatter/deploy junk
This commit is contained in:
@@ -99,17 +99,9 @@ namespace OpenRA.Widgets
|
||||
if (world.OrderGenerator == null) return;
|
||||
|
||||
var orders = world.OrderGenerator.Order(world, xy.ToInt2(), mi).ToArray();
|
||||
orders.Do( o => world.IssueOrder( o ) );
|
||||
|
||||
// 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;
|
||||
}
|
||||
orders.Do( o => world.IssueOrder( o ) );
|
||||
|
||||
world.PlayVoiceForOrders(orders);
|
||||
}
|
||||
|
||||
public override string GetCursor(int2 pos)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user