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(