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();
}
}
}

View File

@@ -1162,7 +1162,7 @@ Armor=light
TechLevel=11
Sight=0
Speed=12
Owner=soviet
Owner=allies
Cost=1200
Points=35
ROT=5
@@ -1195,7 +1195,7 @@ Armor=heavy
TechLevel=9
Sight=0
Speed=12
Owner=soviet
Owner=allies
Cost=1200
Points=40
ROT=4
@@ -1457,7 +1457,7 @@ Strength=800
Armor=wood
TechLevel=9
Sight=5
Owner=allies,soviet
Owner=allies
Cost=1500
Points=70
Power=-10

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- openra/sequences.xml
this file describes animation sequences for structures and units.
@@ -482,4 +482,22 @@
<sequence name="ready" start="3" length="1" />
<sequence name="hold" start="4" length="1" />
</unit>
</sequences>
<unit name="mig">
<sequence name="idle" start="0" length="16" />
</unit>
<unit name="yak">
<sequence name="idle" start="0" length="16" />
</unit>
<unit name="heli">
<sequence name="idle" start="0" length="32" />
<sequence name="rotor" start="0" length="4" src="lrotor" />
</unit>
<unit name="hind">
<sequence name="idle" start="0" length="32" />
<sequence name="rotor" start="0" length="4" src="lrotor" />
</unit>
<unit name="tran">
<sequence name="idle" start="0" length="32" />
<sequence name="rotor" start="0" length="4" src="lrotor" />
</unit>
</sequences>

View File

@@ -116,14 +116,26 @@ HIND
[MIG]
Description=Mig Attack Plane
BuiltAt=afld
Traits=Mobile, RenderUnit
[YAK]
Description=Yak Attack Plane
BuiltAt=afld
Traits=Mobile, RenderUnit
[TRAN]
Description=Transport Helicopter
PrimaryOffset=0,14
SecondaryOffset=0,-14
BuiltAt=hpad
Traits=Mobile, RenderUnitRotor
[HELI]
Description=Longbow
BuiltAt=hpad
Traits=Mobile, RenderUnitRotor
[HIND]
Description=Hind
BuiltAt=hpad
Traits=Mobile, RenderUnitRotor