Convert Explosion to world coords.

This commit is contained in:
Paul Chote
2013-07-06 21:44:39 +12:00
parent 01de84e9fc
commit 1e7f1ab225
3 changed files with 7 additions and 13 deletions

View File

@@ -18,26 +18,20 @@ namespace OpenRA.Mods.RA.Effects
public class Explosion : IEffect
{
Animation anim;
PPos pos;
int altitude;
WPos pos;
public Explosion(World world, PPos pixelPos, string style, bool isWater, int altitude)
public Explosion(World world, WPos pos, string style)
{
this.pos = pixelPos;
this.altitude = altitude;
this.pos = pos;
anim = new Animation("explosion");
anim.PlayThen(style,
() => world.AddFrameEndTask(w => w.Remove(this)));
anim.PlayThen(style, () => world.AddFrameEndTask(w => w.Remove(this)));
}
public void Tick( World world ) { anim.Tick(); }
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
var p = pos.ToInt2() - new int2(0, altitude);
yield return new SpriteRenderable(anim.Image, p, wr.Palette("effect"), p.Y);
yield return new SpriteRenderable(anim.Image, pos, 0, wr.Palette("effect"), 1f);
}
public Player Owner { get { return null; } }
}
}