facings for infantry "stand", and removed code for length-based facings (this probably breaks mods/c&c)

This commit is contained in:
Bob
2010-02-11 13:41:18 +13:00
parent 6e80243095
commit c9b1b25ba8
6 changed files with 20 additions and 33 deletions

View File

@@ -15,12 +15,7 @@ namespace OpenRa.Traits
public void BuildingComplete( Actor self )
{
PlayTurretAnim( self, "idle" );
}
void PlayTurretAnim( Actor self, string a )
{
anim.PlayFacing( a, () => self.traits.Get<Turreted>().turretFacing );
anim.Play( "idle" );
}
public override void Damaged(Actor self, AttackInfo e)
@@ -30,10 +25,10 @@ namespace OpenRa.Traits
switch (e.DamageState)
{
case DamageState.Normal:
PlayTurretAnim(self, "idle");
anim.Play( "idle" );
break;
case DamageState.Half:
PlayTurretAnim(self, "damaged-idle");
anim.Play( "damaged-idle" );
Sound.Play("kaboom1.aud");
break;
}

View File

@@ -13,8 +13,7 @@ namespace OpenRa.Traits
public RenderInfantry(Actor self)
: base(self, () => self.traits.Get<Unit>().Facing)
{
anim.PlayFacing("stand",
() => self.traits.Get<Unit>().Facing);
anim.Play("stand");
}
bool ChooseMoveAnim(Actor self)
@@ -63,8 +62,7 @@ namespace OpenRa.Traits
if (IsProne(self))
anim.PlayFetchIndex("crawl", () => 0); /* what a hack. */
else
anim.PlayFacing("stand",
() => self.traits.Get<Unit>().Facing);
anim.Play("stand");
}
public void Damaged(Actor self, AttackInfo e)

View File

@@ -15,20 +15,14 @@ namespace OpenRa.Traits
public RenderUnit(Actor self)
: base(self, () => self.traits.Get<Unit>().Facing)
{
PlayFacingAnim(self);
anim.Play("idle");
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
}
void PlayFacingAnim(Actor self)
{
var unit = self.traits.Get<Unit>();
anim.PlayFacing("idle", () => unit.Facing);
}
public void PlayCustomAnimation(Actor self, string newAnim, Action after)
{
anim.PlayThen(newAnim, () => { PlayFacingAnim(self); if (after != null) after(); });
anim.PlayThen(newAnim, () => { anim.Play("idle"); if (after != null) after(); });
}
bool isSmoking;

View File

@@ -20,7 +20,7 @@ namespace OpenRa.Traits
var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();
var turretAnim = new Animation(GetImage(self), () => turreted.turretFacing );
turretAnim.PlayFacing( "turret", () => turreted.turretFacing );
turretAnim.Play( "turret" );
if( attackInfo.PrimaryOffset != null )
anims.Add("turret_1", new AnimationWithOffset(

View File

@@ -40,7 +40,7 @@
<sequence name="turret" start="38" facings="32" />
</unit>
<unit name="shok">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="shoot" start="64" length="16" facings="8" />
@@ -56,7 +56,7 @@
<sequence name="die6" start="0" length="14" src="electro" />
</unit>
<unit name="mech">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="run" start="8" length="6" facings="8" />
<sequence name="crawl" start="130" length="4" facings="8" />
<sequence name="die1" start="193" length="8" />

View File

@@ -303,7 +303,7 @@
</unit>
<!-- rifle infantry -->
<unit name="e1">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="stand3" start="128" length="16" />
<sequence name="run" start="16" length="6" facings="8" />
@@ -375,7 +375,7 @@
<sequence name="idle" start="0" length="1" />
</unit>
<unit name="e3">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="shoot" start="64" length="8" facings="8" />
@@ -389,7 +389,7 @@
<sequence name="prone-shoot" start="192" length="10" facings="8" />
</unit>
<unit name="e6">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="die1" start="146" length="8" />
@@ -413,7 +413,7 @@
<sequence name="turret" start="0" facings="32" src="mgun" />
</unit>
<unit name="medi">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="run" start="8" length="6" facings="8" />
<sequence name="heal" start="56" length="58" />
<sequence name="standup" start="114" length="2" facings="8" />
@@ -612,7 +612,7 @@
<sequence name="idle" start="0" length="7" />
</unit>
<unit name="e2">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="shoot" start="64" length="20" facings="8" />
@@ -629,7 +629,7 @@
<sequence name="idle" start="0" length="8" />
</unit>
<unit name="dog">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="run" start="8" length="6" facings="8" />
<sequence name="die1" start="236" length="6" />
<sequence name="die2" start="242" length="9" />
@@ -642,7 +642,7 @@
<sequence name="idle" start="0" length="32" />
</unit>
<unit name="spy">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="shoot" start="64" length="8" facings="8" />
@@ -660,7 +660,7 @@
<sequence name="dim" start="4" length="4" />
</unit>
<unit name="e7">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="run" start="8" length="6" facings="8" />
<sequence name="shoot" start="56" length="7" facings="8" />
<sequence name="die1" start="262" length="8" />
@@ -673,7 +673,7 @@
<sequence name="prone-shoot" start="176" length="7" facings="8" />
</unit>
<unit name="e4">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="stand2" start="8" length="8" />
<sequence name="run" start="16" length="6" facings="8" />
<sequence name="shoot" start="64" length="16" facings="8" />
@@ -690,7 +690,7 @@
<sequence name="idle" start="0" length="8" />
</unit>
<unit name="thf">
<sequence name="stand" start="0" length="8" />
<sequence name="stand" start="0" facings="8" />
<sequence name="run" start="8" length="6" facings="8" />
<sequence name="die1" start="139" length="8" />
<sequence name="die2" start="147" length="8" />