Seperated power into 'power provided' and 'power consumed'
This commit is contained in:
@@ -107,7 +107,7 @@ namespace OpenRa.Game.Graphics
|
|||||||
Game.OreTime * 1000,
|
Game.OreTime * 1000,
|
||||||
Game.LocalPlayer.Cash,
|
Game.LocalPlayer.Cash,
|
||||||
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
||||||
Game.LocalPlayer.Power
|
Game.LocalPlayer.GetTotalPower()
|
||||||
), new int2(5, 5), Color.White);
|
), new int2(5, 5), Color.White);
|
||||||
|
|
||||||
PerfHistory.Render(renderer, lineRenderer);
|
PerfHistory.Render(renderer, lineRenderer);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ namespace OpenRa.Game
|
|||||||
public Race Race;
|
public Race Race;
|
||||||
public readonly int Index;
|
public readonly int Index;
|
||||||
public int Cash;
|
public int Cash;
|
||||||
public int Power;
|
int powerProvided;
|
||||||
|
int powerDrained;
|
||||||
|
|
||||||
public Player( int index, int palette, string playerName, Race race )
|
public Player( int index, int palette, string playerName, Race race )
|
||||||
{
|
{
|
||||||
@@ -20,7 +21,20 @@ namespace OpenRa.Game
|
|||||||
this.PlayerName = playerName;
|
this.PlayerName = playerName;
|
||||||
this.Race = race;
|
this.Race = race;
|
||||||
this.Cash = 10000;
|
this.Cash = 10000;
|
||||||
this.Power = 0;
|
this.powerProvided = this.powerDrained = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangePower(int dPower)
|
||||||
|
{
|
||||||
|
if (dPower > 0)
|
||||||
|
powerProvided += dPower;
|
||||||
|
if (dPower < 0)
|
||||||
|
powerDrained -= dPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetTotalPower()
|
||||||
|
{
|
||||||
|
return powerProvided - powerDrained;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetSiloFullness()
|
public float GetSiloFullness()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRa.Game.Traits
|
|||||||
UnitInfo.BuildingInfo bi = self.unitInfo as UnitInfo.BuildingInfo;
|
UnitInfo.BuildingInfo bi = self.unitInfo as UnitInfo.BuildingInfo;
|
||||||
if (bi == null) return;
|
if (bi == null) return;
|
||||||
|
|
||||||
self.Owner.Power += bi.Power;
|
self.Owner.ChangePower(bi.Power);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user