added Sound.PlayToPlayer. changed existing if(localPlayer) Play() idiom to use it. fixed two places that used Play where PlayToPlayer was correct (mcvUndeploy and "spyplane ready")

This commit is contained in:
Bob
2010-01-26 12:43:23 +13:00
parent c979372d27
commit f3f8fdef90
17 changed files with 42 additions and 53 deletions

View File

@@ -88,10 +88,9 @@ namespace OpenRa
void GiveAdvice(string advice)
{
if (this != World.LocalPlayer) return;
// todo: store the condition or something.
// repeat after Rules.General.SpeakDelay, as long as the condition holds.
Sound.Play(advice);
Sound.PlayToPlayer(this, advice);
}
public void GiveCash( int num ) { Cash += num; }
@@ -129,22 +128,19 @@ namespace OpenRa
UpdateOreCapacity();
Shroud.Tick( World );
if (this == World.LocalPlayer)
{
var totalMoney = Cash + Ore;
var totalMoney = Cash + Ore;
if (DisplayCash < totalMoney)
{
DisplayCash += Math.Min(displayCashDeltaPerFrame,
totalMoney - DisplayCash);
Sound.Play("cashup1.aud");
}
else if (DisplayCash > totalMoney)
{
DisplayCash -= Math.Min(displayCashDeltaPerFrame,
DisplayCash - totalMoney);
Sound.Play("cashdn1.aud");
}
if (DisplayCash < totalMoney)
{
DisplayCash += Math.Min(displayCashDeltaPerFrame,
totalMoney - DisplayCash);
Sound.PlayToPlayer(this, "cashup1.aud");
}
else if (DisplayCash > totalMoney)
{
DisplayCash -= Math.Min(displayCashDeltaPerFrame,
DisplayCash - totalMoney);
Sound.PlayToPlayer(this, "cashdn1.aud");
}
}