low power notif

This commit is contained in:
Chris Forbes
2009-12-05 22:39:35 +13:00
parent 8a3bf7d805
commit 8d03411096

View File

@@ -41,6 +41,9 @@ namespace OpenRa.Game
powerProvided += dPower; powerProvided += dPower;
if (dPower < 0) if (dPower < 0)
powerDrained -= dPower; powerDrained -= dPower;
if (powerDrained > powerProvided)
GiveAdvice("lopower1.aud");
} }
public float GetSiloFullness() public float GetSiloFullness()
@@ -57,6 +60,13 @@ namespace OpenRa.Game
.Sum(b => b.Storage); .Sum(b => b.Storage);
} }
void GiveAdvice(string advice)
{
// todo: store the condition or something.
// repeat after Rules.General.SpeakDelay, as long as the condition holds.
Sound.Play(advice);
}
public void GiveCash( int num ) { Cash += num; } public void GiveCash( int num ) { Cash += num; }
public void GiveOre(int num) public void GiveOre(int num)
{ {
@@ -67,7 +77,7 @@ namespace OpenRa.Game
Ore = capacity; // trim off the overflow. Ore = capacity; // trim off the overflow.
if (Ore > .8 * capacity) if (Ore > .8 * capacity)
Sound.Play("silond1.aud"); GiveAdvice("silond1.aud"); // silos needed
} }
public bool TakeCash( int num ) public bool TakeCash( int num )