factored out flying unit render into WithShadow:IRenderModifier

This commit is contained in:
Chris Forbes
2009-12-21 18:13:52 +13:00
parent 994266d95f
commit dbe962364b
7 changed files with 33 additions and 61 deletions

View File

@@ -24,20 +24,11 @@ namespace OpenRa.Game.Traits
{
var unit = self.traits.Get<Unit>();
yield return Util.CenteredShadow(self, anim.Image, self.CenterLocation);
yield return Util.CenteredShadow(self, rotorAnim.Image, self.CenterLocation
+ Util.GetTurretPosition(self, unit, self.Info.PrimaryOffset, 0));
if (self.Info.SecondaryOffset != null)
yield return Util.CenteredShadow(self, (secondRotorAnim ?? rotorAnim).Image, self.CenterLocation
+ Util.GetTurretPosition(self, unit, self.Info.SecondaryOffset, 0));
var p = self.CenterLocation - new float2( 0, unit.Altitude );
yield return Util.Centered(self, anim.Image, p);
yield return Util.Centered(self, rotorAnim.Image, p
yield return Util.Centered(self, anim.Image, self.CenterLocation);
yield return Util.Centered(self, rotorAnim.Image, self.CenterLocation
+ Util.GetTurretPosition( self, unit, self.Info.PrimaryOffset, 0 ) );
if (self.Info.SecondaryOffset != null)
yield return Util.Centered(self, (secondRotorAnim ?? rotorAnim).Image, p
yield return Util.Centered(self, (secondRotorAnim ?? rotorAnim).Image, self.CenterLocation
+ Util.GetTurretPosition( self, unit, self.Info.SecondaryOffset, 0 ) );
}
@@ -55,9 +46,9 @@ namespace OpenRa.Game.Traits
if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor"))
return;
rotorAnim.PlayRepeatingPreservingPosition(isFlying ? "rotor" : "slow-rotor");
rotorAnim.ReplaceAnim(isFlying ? "rotor" : "slow-rotor");
if (secondRotorAnim != null)
secondRotorAnim.PlayRepeatingPreservingPosition(isFlying ? "rotor2" : "slow-rotor2");
secondRotorAnim.ReplaceAnim(isFlying ? "rotor2" : "slow-rotor2");
}
}
}