Files
OpenRA/OpenRa.Game/Traits/RenderUnitTurreted.cs
Bob 707ba7d957 Locked frame times; SAM, GUN, AGUN work again.
- all frames are 40ms long. (except something in the sidebar, which should really be PlayFetchIndex anyway)
    - SAM, GUN, and AGUN no longer crash the game when built. (Turreted used Mobile, which those buildings don't have)
2009-10-20 00:57:50 +13:00

35 lines
850 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.Graphics;
using IjwFramework.Types;
namespace OpenRa.Game.Traits
{
class RenderUnitTurreted : RenderUnit
{
public Animation turretAnim;
public RenderUnitTurreted(Actor self)
: base(self)
{
turretAnim = new Animation(self.unitInfo.Name);
turretAnim.PlayFetchIndex("turret", () => self.traits.Get<Turreted>().turretFacing / 8);
}
public override IEnumerable<Pair<Sprite, float2>> Render(Actor self)
{
var mobile = self.traits.Get<Mobile>();
yield return Centered(anim.Image, self.CenterLocation);
yield return Centered(turretAnim.Image, self.CenterLocation);
}
public override void Tick(Actor self, Game game)
{
base.Tick(self, game);
turretAnim.Tick();
}
}
}