add IHasLocation

This commit is contained in:
Bob
2010-10-08 19:10:31 +13:00
committed by Chris Forbes
parent 9c362f7d41
commit 011a20e8b4
31 changed files with 133 additions and 107 deletions

View File

@@ -44,16 +44,16 @@ namespace OpenRA.Traits
public readonly BuildingInfo Info;
[Sync]
readonly int2 topLeft;
readonly PowerManager PlayerPower;
public int2 PxPosition { get { return ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2; } }
public Building(ActorInitializer init)
{
this.self = init.self;
this.topLeft = init.Get<LocationInit,int2>();
Info = self.Info.Traits.Get<BuildingInfo>();
self.CenterLocation = Game.CellSize
* ((float2)topLeft + .5f * (float2)Info.Dimensions);
PlayerPower = init.self.Owner.PlayerActor.Trait<PowerManager>();
}