diff --git a/OpenRa.Game/Traits/RenderBuilding.cs b/OpenRa.Game/Traits/RenderBuilding.cs index fa02d7cb14..f795b1d26c 100644 --- a/OpenRa.Game/Traits/RenderBuilding.cs +++ b/OpenRa.Game/Traits/RenderBuilding.cs @@ -19,7 +19,7 @@ namespace OpenRa.Traits if( Game.skipMakeAnims ) Complete( self ); else - anim.PlayThen( "make", () => Complete( self ) ); + anim.PlayThen( "make", () => Game.world.AddFrameEndTask( _ => Complete( self ) ) ); DoBib(self, false); } diff --git a/OpenRa.Game/Traits/RenderBuildingWarFactory.cs b/OpenRa.Game/Traits/RenderBuildingWarFactory.cs index ba0b5cd6ed..8d2a0b62f2 100644 --- a/OpenRa.Game/Traits/RenderBuildingWarFactory.cs +++ b/OpenRa.Game/Traits/RenderBuildingWarFactory.cs @@ -9,14 +9,11 @@ namespace OpenRa.Traits public object Create(Actor self) { return new RenderWarFactory(self); } } - class RenderWarFactory : IRender, INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction + class RenderWarFactory : INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction { public Animation roof; [Sync] - bool doneBuilding; - [Sync] bool isOpen; - public readonly Actor self; string GetPrefix(Actor self) { @@ -25,27 +22,17 @@ namespace OpenRa.Traits public RenderWarFactory(Actor self) { - this.self = self; roof = new Animation(self.traits.Get().GetImage(self)); } public void BuildingComplete( Actor self ) { - doneBuilding = true; roof.Play( GetPrefix(self) + "idle-top" ); - } - - public IEnumerable Render(Actor self) - { - if (doneBuilding) - yield return new Renderable(roof.Image, - Game.CellSize * (float2)self.Location, self.Owner.Palette, 2); + self.traits.Get().anims.Add( "roof", new RenderSimple.AnimationWithOffset( roof ) { ZOffset = 2 } ); } public void Tick(Actor self) { - if (doneBuilding) roof.Tick(); - var b = self.GetBounds(false); if (isOpen && !Game.world.UnitInfluence.GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any()) {