Convert yaml-exposed facings to WAngle.

This commit is contained in:
Paul Chote
2020-07-09 22:08:38 +01:00
committed by reaperrr
parent 6d12301f88
commit ac975f4139
80 changed files with 477 additions and 370 deletions

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Velocity = 75;
[Desc("Speed at which the particle turns.")]
public readonly int TurnSpeed = 15;
public readonly WAngle TurnSpeed = new WAngle(60);
public override object Create(ActorInitializer init) { return new ThrowsParticle(init, this); }
}
@@ -80,9 +80,9 @@ namespace OpenRA.Mods.Common.Traits
length = (finalPos - initialPos).Length / info.Velocity;
// WAngle requires positive inputs, so track the speed and direction separately
var rotationSpeed = WDist.FromPDF(Game.CosmeticRandom, 2).Length * info.TurnSpeed / 1024;
var rotationSpeed = WDist.FromPDF(Game.CosmeticRandom, 2).Length * info.TurnSpeed.Angle / 1024;
direction = rotationSpeed < 0 ? -1 : 1;
rotation = WAngle.FromFacing(Math.Abs(rotationSpeed));
rotation = new WAngle(Math.Abs(rotationSpeed));
var anim = new Animation(init.World, rs.GetImage(self), () => facing);
anim.PlayRepeating(info.Anim);