Convert Smoke to world coordinates.
This commit is contained in:
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
if (Info.Trail != null && --ticksToNextSmoke < 0)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new Smoke(w, (PPos) highPos.ToInt2(), Info.Trail)));
|
||||
new Smoke(w, ((PPos)highPos.ToInt2()).ToWPos(0), Info.Trail)));
|
||||
ticksToNextSmoke = Info.TrailInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
|
||||
if (--ticksToNextSmoke < 0)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail)));
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp.ToWPos(0), Info.Trail)));
|
||||
ticksToNextSmoke = Info.TrailInterval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user