Pass the sequence name to the Corpse effect instead of an InfDeath number. Only play death animations for standard deaths.

This commit is contained in:
Paul Chote
2011-06-26 14:07:15 +12:00
parent 19ead53223
commit 7173d193cf
2 changed files with 7 additions and 4 deletions

View File

@@ -21,12 +21,12 @@ namespace OpenRA.Mods.RA.Effects
readonly float2 pos;
readonly string palette;
public Corpse(Actor fromActor, int death)
public Corpse(Actor fromActor, string sequence)
{
var rs = fromActor.Trait<RenderSimple>();
palette = rs.Palette(fromActor.Owner);
anim = new Animation(rs.GetImage(fromActor));
anim.PlayThen("die{0}".F(death + 1),
anim.PlayThen(sequence,
() => fromActor.World.AddFrameEndTask(w => w.Remove(this)));
pos = fromActor.CenterLocation;

View File

@@ -119,9 +119,12 @@ namespace OpenRA.Mods.RA.Render
public void Killed(Actor self, AttackInfo e)
{
var death = e.Warhead != null ? e.Warhead.InfDeath : 0;
// Killed by some non-standard means
if (e.Warhead == null)
return;
Sound.PlayVoice("Die", self, self.Owner.Country.Race);
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, death)));
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, "die{0}".F(e.Warhead.InfDeath + 1))));
}
}
}