low power slowdown

This commit is contained in:
Chris Forbes
2009-12-08 20:56:15 +13:00
parent bcea1f01b0
commit 0dbf1bf027
5 changed files with 24 additions and 3 deletions

View File

@@ -6,6 +6,8 @@ using OpenRa.Game.Traits;
namespace OpenRa.Game
{
enum PowerState { Normal, Low, Critical };
class Player
{
public int Palette;
@@ -65,6 +67,13 @@ namespace OpenRa.Game
return (float)Ore / GetOreCapacity();
}
public PowerState GetPowerState()
{
if (powerProvided >= powerDrained) return PowerState.Normal;
if (powerProvided > powerDrained / 2) return PowerState.Low;
return PowerState.Critical;
}
public int GetOreCapacity()
{
return Game.world.Actors