Use a consistent set of arguments for Render* ctors.

This commit is contained in:
Paul Chote
2014-07-09 19:00:35 +12:00
committed by Paul Chote
parent d135e58ad9
commit f606a1bfd7
12 changed files with 54 additions and 53 deletions

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class RenderSimpleInfo : RenderSpritesInfo, IRenderActorPreviewSpritesInfo, IQuantizeBodyOrientationInfo, ILegacyEditorRenderInfo, Requires<IBodyOrientationInfo>
{
public override object Create(ActorInitializer init) { return new RenderSimple(init.Self); }
public override object Create(ActorInitializer init) { return new RenderSimple(init, this); }
public virtual IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{
@@ -43,17 +43,17 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly Animation DefaultAnimation;
public RenderSimple(Actor self, Func<int> baseFacing)
: base(self)
public RenderSimple(ActorInitializer init, RenderSimpleInfo info, Func<int> baseFacing)
: base(init, info)
{
DefaultAnimation = new Animation(self.World, GetImage(self), baseFacing);
DefaultAnimation = new Animation(init.World, GetImage(init.Self), baseFacing);
Add("", DefaultAnimation);
}
public RenderSimple(Actor self)
: this(self, MakeFacingFunc(self))
public RenderSimple(ActorInitializer init, RenderSimpleInfo info)
: this(init, info, MakeFacingFunc(init.Self))
{
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, "idle"));
}
public int2 SelectionSize(Actor self) { return AutoSelectionSize(self); }