Hide WithBuildingPlacedOverlay after it has been played

Fixes #9319.
This commit is contained in:
reaperrr
2015-09-19 15:21:34 +02:00
parent 97346e1833
commit e99c951a0c

View File

@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
readonly Animation overlay; readonly Animation overlay;
bool buildComplete; bool buildComplete;
bool visible;
public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info) public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info)
{ {
@@ -47,15 +48,16 @@ namespace OpenRA.Mods.Common.Traits
var anim = new AnimationWithOffset(overlay, var anim = new AnimationWithOffset(overlay,
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), () => 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); rs.Add(anim, info.Palette, info.IsPlayerPalette);
} }
public void BuildingComplete(Actor self) public void BuildingComplete(Actor self)
{ {
buildComplete = true; buildComplete = true;
visible = false;
} }
public void Sold(Actor self) { } public void Sold(Actor self) { }
@@ -79,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits
public void BuildingPlaced(Actor self) public void BuildingPlaced(Actor self)
{ {
overlay.Play(overlay.CurrentSequence.Name); visible = true;
overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false);
} }
} }
} }