Hide corpses under fog.
This commit is contained in:
@@ -17,23 +17,30 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
public class Corpse : IEffect
|
public class Corpse : IEffect
|
||||||
{
|
{
|
||||||
readonly Animation Anim;
|
readonly World world;
|
||||||
readonly WPos Pos;
|
readonly WPos pos;
|
||||||
readonly string PaletteName;
|
readonly CPos cell;
|
||||||
|
readonly string paletteName;
|
||||||
|
readonly Animation anim;
|
||||||
|
|
||||||
public Corpse(World world, WPos pos, string image, string sequence, string paletteName)
|
public Corpse(World world, WPos pos, string image, string sequence, string paletteName)
|
||||||
{
|
{
|
||||||
Pos = pos;
|
this.world = world;
|
||||||
PaletteName = paletteName;
|
this.pos = pos;
|
||||||
Anim = new Animation(image);
|
this.cell = pos.ToCPos();
|
||||||
Anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
|
this.paletteName = paletteName;
|
||||||
|
anim = new Animation(image);
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
return Anim.Render(Pos, wr.Palette(PaletteName));
|
if (world.FogObscures(cell))
|
||||||
|
return SpriteRenderable.None;
|
||||||
|
|
||||||
|
return anim.Render(pos, wr.Palette(paletteName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user