Convert Corpse to world coordinates.
This commit is contained in:
@@ -17,23 +17,23 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
public class Corpse : IEffect
|
public class Corpse : IEffect
|
||||||
{
|
{
|
||||||
readonly Animation anim;
|
readonly Animation Anim;
|
||||||
readonly float2 pos;
|
readonly WPos Pos;
|
||||||
readonly string paletteName;
|
readonly string PaletteName;
|
||||||
|
|
||||||
public Corpse(World world, float2 pos, string image, string sequence, string paletteName)
|
public Corpse(World world, WPos pos, string image, string sequence, string paletteName)
|
||||||
{
|
{
|
||||||
this.pos = pos;
|
Pos = pos;
|
||||||
this.paletteName = paletteName;
|
PaletteName = paletteName;
|
||||||
anim = new Animation(image);
|
Anim = new Animation(image);
|
||||||
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
|
Anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(World world) { anim.Tick(); }
|
public void Tick(World world) { Anim.Tick(); }
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
yield return new SpriteRenderable(anim.Image, pos, wr.Palette(paletteName), (int)pos.Y);
|
yield return new SpriteRenderable(Anim.Image, Pos, 0, wr.Palette(PaletteName), 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
if (!self.Destroyed)
|
if (!self.Destroyed)
|
||||||
w.Add(new Corpse(w, self.CenterLocation.ToFloat2(), GetImage(self),
|
w.Add(new Corpse(w, self.CenterPosition, GetImage(self),
|
||||||
sequence, Info.PlayerPalette+self.Owner.InternalName));
|
sequence, Info.PlayerPalette+self.Owner.InternalName));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user