Convert AnimationWithOffset to world coords.

Animations (via Actor.CenterPosition) now
understand Altitude, so there is potential for
mis-positioned animations if any existing altitude
hacks were missed.
This commit is contained in:
Paul Chote
2013-05-14 21:02:46 +12:00
parent fb17654ea0
commit fe716e76a7
16 changed files with 64 additions and 66 deletions

View File

@@ -18,7 +18,9 @@ namespace OpenRA.Mods.Cnc
{
class RenderBuildingRefineryInfo : RenderBuildingInfo
{
public override object Create(ActorInitializer init) { return new RenderBuildingRefinery( init, this ); }
public readonly WVec Offset = new WVec(1365, 896, 0);
public override object Create(ActorInitializer init) { return new RenderBuildingRefinery(init, this); }
}
class RenderBuildingRefinery : RenderBuilding, INotifyBuildComplete, INotifySold, INotifyCapture
@@ -27,7 +29,7 @@ namespace OpenRA.Mods.Cnc
PlayerResources playerResources;
bool buildComplete;
public RenderBuildingRefinery(ActorInitializer init, RenderBuildingInfo info)
public RenderBuildingRefinery(ActorInitializer init, RenderBuildingRefineryInfo info)
: base(init, info)
{
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
@@ -38,9 +40,7 @@ namespace OpenRA.Mods.Cnc
? (59 * playerResources.Ore) / (10 * playerResources.OreCapacity)
: 0);
var offset = new float2(-32,-21);
anims.Add("lights", new AnimationWithOffset( lights, wr => offset, () => !buildComplete )
{ ZOffset = 24 });
anims.Add("lights", new AnimationWithOffset(lights, () => info.Offset, () => !buildComplete, 24));
}
public void BuildingComplete( Actor self )