Files
OpenRA/OpenRa.Game/Traits/Building.cs
2009-12-05 14:23:59 +13:00

30 lines
579 B
C#

using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits
{
class Building : ITick, INotifyBuildComplete
{
public readonly BuildingInfo unitInfo;
public Building(Actor self)
{
unitInfo = (BuildingInfo)self.unitInfo;
}
bool first = true;
public void Tick(Actor self)
{
if (first)
self.CenterLocation = Game.CellSize * (float2)self.Location + 0.5f * self.SelectedSize;
first = false;
}
public void BuildingComplete(Actor self)
{
if (self.Owner != null)
self.Owner.ChangePower(unitInfo.Power);
}
}
}