Convert Smoke to world coordinates.

This commit is contained in:
Paul Chote
2013-05-16 01:03:54 +12:00
parent c6e6977bf6
commit 3e1c1096c2
6 changed files with 13 additions and 14 deletions

View File

@@ -17,26 +17,25 @@ namespace OpenRA.Mods.RA.Effects
{
public class Smoke : IEffect
{
readonly PPos pos;
readonly Animation anim;
readonly WPos Pos;
readonly Animation Anim;
public Smoke(World world, PPos pos, string trail)
public Smoke(World world, WPos pos, string trail)
{
this.pos = pos;
anim = new Animation(trail);
anim.PlayThen("idle",
Pos = pos;
Anim = new Animation(trail);
Anim.PlayThen("idle",
() => world.AddFrameEndTask(w => w.Remove(this)));
}
public void Tick( World world )
{
anim.Tick();
Anim.Tick();
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
yield return new SpriteRenderable(anim.Image, pos.ToFloat2(),
wr.Palette("effect"), (int)pos.Y);
yield return new SpriteRenderable(Anim.Image, Pos, 0, wr.Palette("effect"), 1f);
}
}
}