Merge branch 'master' of git://github.com/beedee/OpenRA
This commit is contained in:
@@ -100,13 +100,14 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
lineRenderer.Flush();
|
||||
|
||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nTiles Expanded {6:F0}",
|
||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nPower {7}\nTiles Expanded {6:F0}",
|
||||
Game.RenderFrame, Game.orderManager.FrameNumber,
|
||||
Game.RenderTime * 1000,
|
||||
Game.TickTime * 1000,
|
||||
Game.OreTime * 1000,
|
||||
Game.LocalPlayer.Cash,
|
||||
PerfHistory.items[ "nodes_expanded" ].LastValue
|
||||
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
||||
Game.LocalPlayer.Power
|
||||
), new int2(5, 5), Color.White);
|
||||
|
||||
PerfHistory.Render(renderer, lineRenderer);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace OpenRa.Game
|
||||
public Race Race;
|
||||
public readonly int Index;
|
||||
public int Cash;
|
||||
public int Power;
|
||||
|
||||
public Player( int index, int palette, string playerName, Race race )
|
||||
{
|
||||
@@ -19,6 +20,7 @@ namespace OpenRa.Game
|
||||
this.PlayerName = playerName;
|
||||
this.Race = race;
|
||||
this.Cash = 10000;
|
||||
this.Power = 0;
|
||||
}
|
||||
|
||||
public float GetSiloFullness()
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Game.GameRules;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class Building : ITick
|
||||
class Building : ITick, INotifyBuildComplete
|
||||
{
|
||||
public Building(Actor self)
|
||||
{
|
||||
@@ -19,5 +20,13 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
{
|
||||
UnitInfo.BuildingInfo bi = self.unitInfo as UnitInfo.BuildingInfo;
|
||||
if (bi == null) return;
|
||||
|
||||
self.Owner.Power += bi.Power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,12 @@ namespace OpenRa.Game.Traits
|
||||
public RenderBuilding(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
Make( () => anim.PlayRepeating("idle") );
|
||||
Make(() =>
|
||||
{
|
||||
anim.PlayRepeating("idle");
|
||||
foreach (var x in self.traits.WithInterface<INotifyBuildComplete>())
|
||||
x.BuildingComplete(self);
|
||||
});
|
||||
|
||||
DoBib(self, false);
|
||||
}
|
||||
|
||||
@@ -14,4 +14,5 @@ namespace OpenRa.Game.Traits
|
||||
interface IOrder { Order Order(Actor self, int2 xy, bool lmb, Actor underCursor); }
|
||||
interface INotifyDamage { void Damaged(Actor self, DamageState ds); }
|
||||
interface INotifyDamageEx : INotifyDamage { void Damaged(Actor self, int damage); }
|
||||
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user