From 9aa861eca935e5bca0cf1d93438294f9b3c23a2d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 3 Sep 2017 12:09:04 +0200 Subject: [PATCH] Spatially partition CrateEffect --- OpenRA.Mods.Common/Effects/CrateEffect.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/CrateEffect.cs b/OpenRA.Mods.Common/Effects/CrateEffect.cs index 1b95ae9044..33e9a2273a 100644 --- a/OpenRA.Mods.Common/Effects/CrateEffect.cs +++ b/OpenRA.Mods.Common/Effects/CrateEffect.cs @@ -15,7 +15,7 @@ using OpenRA.Graphics; namespace OpenRA.Mods.Common.Effects { - public class CrateEffect : IEffect + public class CrateEffect : IEffect, ISpatiallyPartitionable { readonly string palette; readonly Actor a; @@ -27,12 +27,14 @@ namespace OpenRA.Mods.Common.Effects this.palette = palette; anim = new Animation(a.World, "crate-effects"); - anim.PlayThen(seq, () => a.World.AddFrameEndTask(w => w.Remove(this))); + anim.PlayThen(seq, () => a.World.AddFrameEndTask(w => { w.Remove(this); w.ScreenMap.Remove(this); })); + a.World.ScreenMap.Add(this, a.CenterPosition, anim.Image); } public void Tick(World world) { anim.Tick(); + world.ScreenMap.Update(this, a.CenterPosition, anim.Image); } public IEnumerable Render(WorldRenderer wr)