RenderBuilding.BuildingPreview pushed down to RenderSimple and renamed to .RenderPreview()

This commit is contained in:
Chris Forbes
2011-01-08 20:24:12 +13:00
committed by Paul Chote
parent e6c6e8aa96
commit 0f84ac5215
4 changed files with 15 additions and 8 deletions

View File

@@ -22,6 +22,14 @@ namespace OpenRA.Traits
public readonly string Palette = null;
public readonly float Scale = 1f;
public abstract object Create(ActorInitializer init);
public virtual IEnumerable<Renderable> RenderPreview(ActorInfo building, string Tileset)
{
var anim = new Animation(RenderSimple.GetImage(building, Tileset), () => 0);
anim.PlayRepeating("idle");
var rb = building.Traits.Get<RenderSimpleInfo>();
yield return new Renderable(anim.Image, 0.5f * anim.Image.size * (1 - Scale), rb.Palette, 0, Scale);
}
}
public abstract class RenderSimple : IRender, ITick