Planes, kinda. They don't fly.

This commit is contained in:
Bob
2009-11-02 21:47:33 +13:00
parent ddc91ddafa
commit 3ada04ac8a
5 changed files with 74 additions and 5 deletions

View File

@@ -143,6 +143,7 @@
<Compile Include="Traits\RenderBuildingWarFactory.cs" />
<Compile Include="Traits\RenderSimple.cs" />
<Compile Include="Traits\RenderUnit.cs" />
<Compile Include="Traits\RenderUnitRotor.cs" />
<Compile Include="Traits\RenderUnitTurreted.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\Tree.cs" />

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Types;
using OpenRa.Game.Graphics;
namespace OpenRa.Game.Traits
{
class RenderUnitRotor : RenderUnit
{
public Animation rotorAnim;
public RenderUnitRotor( Actor self )
: base(self)
{
rotorAnim = new Animation(self.unitInfo.Name);
rotorAnim.PlayRepeating("rotor");
}
public override IEnumerable<Pair<Sprite, float2>> Render(Actor self)
{
var mobile = self.traits.Get<Mobile>();
yield return Util.Centered(anim.Image, self.CenterLocation);
yield return Util.Centered(rotorAnim.Image, self.CenterLocation
+ Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, 0));
if (self.unitInfo.SecondaryOffset != null)
yield return Util.Centered(rotorAnim.Image, self.CenterLocation
+ Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, 0));
}
public override void Tick(Actor self)
{
base.Tick(self);
rotorAnim.Tick();
}
}
}