Spatially partition CrateEffect
This commit is contained in:
@@ -15,7 +15,7 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
namespace OpenRA.Mods.Common.Effects
|
||||||
{
|
{
|
||||||
public class CrateEffect : IEffect
|
public class CrateEffect : IEffect, ISpatiallyPartitionable
|
||||||
{
|
{
|
||||||
readonly string palette;
|
readonly string palette;
|
||||||
readonly Actor a;
|
readonly Actor a;
|
||||||
@@ -27,12 +27,14 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.palette = palette;
|
this.palette = palette;
|
||||||
|
|
||||||
anim = new Animation(a.World, "crate-effects");
|
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)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
anim.Tick();
|
anim.Tick();
|
||||||
|
world.ScreenMap.Update(this, a.CenterPosition, anim.Image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
|
|||||||
Reference in New Issue
Block a user