This commit is contained in:
Chris Forbes
2009-11-09 15:51:24 +13:00
parent 651399ed19
commit 73429dcbc9
4 changed files with 15 additions and 2 deletions

View File

@@ -50,6 +50,7 @@ namespace OpenRa.Game.GameRules
public readonly int[] PrimaryOffset = { 0, 0 }; public readonly int[] PrimaryOffset = { 0, 0 };
public readonly int[] SecondaryOffset = null; public readonly int[] SecondaryOffset = null;
public readonly int Recoil = 0; public readonly int Recoil = 0;
public readonly string SecondaryAnim = null;
public UnitInfo(string name) { Name = name; } public UnitInfo(string name) { Name = name; }

View File

@@ -8,13 +8,19 @@ namespace OpenRa.Game.Traits
{ {
class RenderUnitRotor : RenderUnit class RenderUnitRotor : RenderUnit
{ {
public Animation rotorAnim; public Animation rotorAnim, secondRotorAnim;
public RenderUnitRotor( Actor self ) public RenderUnitRotor( Actor self )
: base(self) : base(self)
{ {
rotorAnim = new Animation(self.unitInfo.Name); rotorAnim = new Animation(self.unitInfo.Name);
rotorAnim.PlayRepeating("rotor"); rotorAnim.PlayRepeating("rotor");
if (self.unitInfo.SecondaryAnim != null)
{
secondRotorAnim = new Animation(self.unitInfo.Name);
rotorAnim.PlayRepeating(self.unitInfo.SecondaryAnim);
}
} }
public override IEnumerable<Pair<Sprite, float2>> Render(Actor self) public override IEnumerable<Pair<Sprite, float2>> Render(Actor self)
@@ -25,7 +31,7 @@ namespace OpenRa.Game.Traits
yield return Util.Centered(rotorAnim.Image, self.CenterLocation yield return Util.Centered(rotorAnim.Image, self.CenterLocation
+ Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, 0)); + Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, 0));
if (self.unitInfo.SecondaryOffset != null) if (self.unitInfo.SecondaryOffset != null)
yield return Util.Centered(rotorAnim.Image, self.CenterLocation yield return Util.Centered((secondRotorAnim ?? rotorAnim).Image, self.CenterLocation
+ Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, 0)); + Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, 0));
} }
@@ -33,6 +39,8 @@ namespace OpenRa.Game.Traits
{ {
base.Tick(self); base.Tick(self);
rotorAnim.Tick(); rotorAnim.Tick();
if (secondRotorAnim != null)
secondRotorAnim.Tick();
} }
} }
} }

View File

@@ -499,6 +499,9 @@
<unit name="tran"> <unit name="tran">
<sequence name="idle" start="0" length="32" /> <sequence name="idle" start="0" length="32" />
<sequence name="rotor" start="0" length="4" src="lrotor" /> <sequence name="rotor" start="0" length="4" src="lrotor" />
<sequence name="rotor2" start="0" length="4" src="rrotor" />
<sequence name="slow-rotor" start="4" length="8" src="lrotor" />
<sequence name="slow-rotor2" start="4" length="8" src="rrotor" />
</unit> </unit>
<unit name="v2"> <unit name="v2">
<sequence name="idle" start="0" length="32" /> <sequence name="idle" start="0" length="32" />

View File

@@ -126,6 +126,7 @@ PrimaryOffset=0,14,0,-4
SecondaryOffset=0,-14,0,-2 SecondaryOffset=0,-14,0,-2
BuiltAt=hpad BuiltAt=hpad
Traits=Mobile, RenderUnitRotor Traits=Mobile, RenderUnitRotor
SecondaryAnim=rotor2
[HELI] [HELI]
Description=Longbow Description=Longbow
BuiltAt=hpad BuiltAt=hpad