Spatially partition CrateEffect

This commit is contained in:
reaperrr
2017-09-03 12:09:04 +02:00
committed by Paul Chote
parent 46132ed5c6
commit 9aa861eca9

View File

@@ -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<IRenderable> Render(WorldRenderer wr)