RenderUnitTurreted ported

This commit is contained in:
Chris Forbes
2010-01-11 18:49:28 +13:00
parent 4b19f1dfe5
commit b94e5441dc
5 changed files with 20 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Game.Graphics;
namespace OpenRa.Game.Traits
@@ -16,9 +17,14 @@ namespace OpenRa.Game.Traits
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
public Animation anim { get { return anims[ "" ].Animation; } }
public string GetImage(Actor self)
{
return self.Info.Traits.WithInterface<RenderSimpleInfo>().First().Image ?? self.Info.Name;
}
public RenderSimple(Actor self)
{
anims.Add( "", new Animation( self.LegacyInfo.Image ?? self.LegacyInfo.Name ) );
anims.Add( "", new Animation( GetImage(self) ) );
}
public virtual IEnumerable<Renderable> Render( Actor self )