Make RenderUnit require IFacing; RenderSimple can be used for crates, mines, etc; fix husk facing init

This commit is contained in:
Chris Forbes
2011-07-28 21:20:31 +12:00
parent 7044d81a40
commit ddc1311d87
11 changed files with 36 additions and 21 deletions

View File

@@ -14,13 +14,14 @@ using OpenRA.Graphics;
namespace OpenRA.Traits
{
public abstract class RenderSimpleInfo : ITraitInfo
public class RenderSimpleInfo : ITraitInfo
{
public readonly string Image = null;
public readonly string Palette = null;
public readonly string PlayerPalette = "player";
public readonly float Scale = 1f;
public abstract object Create(ActorInitializer init);
public virtual object Create(ActorInitializer init) { return new RenderSimple(init.self); }
public virtual IEnumerable<Renderable> RenderPreview(ActorInfo building, Player owner)
{
@@ -30,7 +31,7 @@ namespace OpenRA.Traits
}
}
public abstract class RenderSimple : IRender, ITick
public class RenderSimple : IRender, ITick
{
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
@@ -70,6 +71,11 @@ namespace OpenRA.Traits
Info = self.Info.Traits.Get<RenderSimpleInfo>();
}
public RenderSimple(Actor self) : this( self, MakeFacingFunc(self) )
{
anim.PlayRepeating("idle");
}
public string Palette(Player p) { return Info.Palette ?? Info.PlayerPalette + p.InternalName; }
public virtual IEnumerable<Renderable> Render(Actor self)