Fix WithDeathAnimation dependency.

This commit is contained in:
Paul Chote
2015-03-10 20:14:20 +00:00
parent 6c50d0eda8
commit fa0264a73c

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("This actor has a death animation.")] [Desc("This actor has a death animation.")]
public class WithDeathAnimationInfo : ITraitInfo, Requires<RenderSimpleInfo> public class WithDeathAnimationInfo : ITraitInfo, Requires<RenderSpritesInfo>
{ {
[Desc("Sequence to play when this actor is killed by a warhead.")] [Desc("Sequence to play when this actor is killed by a warhead.")]
public readonly string DeathSequence = "die"; public readonly string DeathSequence = "die";
@@ -35,12 +35,12 @@ namespace OpenRA.Mods.Common.Traits
public class WithDeathAnimation : INotifyKilled public class WithDeathAnimation : INotifyKilled
{ {
public readonly WithDeathAnimationInfo Info; public readonly WithDeathAnimationInfo Info;
readonly RenderSimple renderSimple; readonly RenderSprites rs;
public WithDeathAnimation(Actor self, WithDeathAnimationInfo info) public WithDeathAnimation(Actor self, WithDeathAnimationInfo info)
{ {
Info = info; Info = info;
renderSimple = self.Trait<RenderSimple>(); rs = self.Trait<RenderSprites>();
} }
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (!self.Destroyed) if (!self.Destroyed)
w.Add(new Corpse(w, self.CenterPosition, renderSimple.GetImage(self), sequence, palette)); w.Add(new Corpse(w, self.CenterPosition, rs.GetImage(self), sequence, palette));
}); });
} }
} }