From e99c951a0c47d613b51587a99e7f967d5bca608d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 19 Sep 2015 15:21:34 +0200 Subject: [PATCH] Hide WithBuildingPlacedOverlay after it has been played Fixes #9319. --- .../Traits/Render/WithBuildingPlacedOverlay.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs index fe322347d9..5b8efe8418 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs @@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Animation overlay; bool buildComplete; + bool visible; public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info) { @@ -47,15 +48,16 @@ namespace OpenRA.Mods.Common.Traits var anim = new AnimationWithOffset(overlay, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), - () => !buildComplete); + () => !visible || !buildComplete); - overlay.Play(info.Sequence); + overlay.PlayThen(info.Sequence, () => visible = false); rs.Add(anim, info.Palette, info.IsPlayerPalette); } public void BuildingComplete(Actor self) { buildComplete = true; + visible = false; } public void Sold(Actor self) { } @@ -79,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits public void BuildingPlaced(Actor self) { - overlay.Play(overlay.CurrentSequence.Name); + visible = true; + overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false); } } } \ No newline at end of file