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

@@ -15,6 +15,7 @@ namespace OpenRA.Mods.RA.Widgets
public char AttackMoveKey = 'a';
public char StopKey = 's';
public char ScatterKey = 'x';
public char DeployKey = 'f';
public readonly OrderManager OrderManager;
[ObjectCreator.UseCtor]
@@ -50,11 +51,16 @@ namespace OpenRA.Mods.RA.Widgets
if (e.KeyChar == ScatterKey)
return PerformScatter();
if (e.KeyChar == DeployKey)
return PerformDeploy();
}
return false;
}
// todo: take ALL this garbage and route it through the OrderTargeter stuff.
bool PerformAttackMove()
{
World.OrderGenerator = new GenericSelectTarget(World.Selection.Actors, "AttackMove",
@@ -63,21 +69,28 @@ namespace OpenRA.Mods.RA.Widgets
return true;
}
void PerformKeyboardOrderOnSelection(Func<Actor, Order> f)
{
var orders = World.Selection.Actors.Select(f).ToArray();
foreach (var o in orders) World.IssueOrder(o);
World.PlayVoiceForOrders(orders);
}
bool PerformStop()
{
/* issue a stop order to everyone. */
foreach (var a in World.Selection.Actors)
World.IssueOrder(new Order("Stop", a, false));
PerformKeyboardOrderOnSelection(a => new Order("Stop", a, false));
return true;
}
bool PerformScatter()
{
/* issue a stop order to everyone. */
foreach (var a in World.Selection.Actors)
World.IssueOrder(new Order("Scatter", a, false));
PerformKeyboardOrderOnSelection(a => new Order("Scatter", a, false));
return true;
}
bool PerformDeploy()
{
PerformKeyboardOrderOnSelection(a => new Order("Deploy", a, false));
return true;
}
}