Remove the crumble overlay after it has completed.
This commit is contained in:
@@ -34,16 +34,19 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
|
|
||||||
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
||||||
{
|
{
|
||||||
|
if (init.Contains<SkipMakeAnimsInit>())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var key = "make_overlay_{0}".F(info.Sequence);
|
||||||
var rs = init.self.Trait<RenderSprites>();
|
var rs = init.self.Trait<RenderSprites>();
|
||||||
|
|
||||||
if (!init.Contains<SkipMakeAnimsInit>())
|
var overlay = new Animation(init.world, rs.GetImage(init.self));
|
||||||
{
|
|
||||||
var overlay = new Animation(init.world, rs.GetImage(init.self));
|
// Remove the animation once it is complete
|
||||||
overlay.PlayThen(info.Sequence, () => buildComplete = false);
|
overlay.PlayThen(info.Sequence, () => init.world.AddFrameEndTask(w => rs.Remove(key)));
|
||||||
rs.Add("make_overlay_{0}".F(info.Sequence),
|
|
||||||
new AnimationWithOffset(overlay, null, () => !buildComplete),
|
rs.Add(key, new AnimationWithOffset(overlay, null, () => !buildComplete),
|
||||||
info.Palette, info.IsPlayerPalette);
|
info.Palette, info.IsPlayerPalette);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BuildingComplete(Actor self)
|
public void BuildingComplete(Actor self)
|
||||||
|
|||||||
Reference in New Issue
Block a user