Change IFacing.TurnSpeed to WAngle.

This commit is contained in:
Paul Chote
2020-06-03 18:01:15 +01:00
committed by teinarss
parent 6adf45bcb4
commit 803b930405
8 changed files with 18 additions and 18 deletions

View File

@@ -40,14 +40,14 @@ namespace OpenRA.Mods.Common
/// If facing is already within step of desiredFacing then desiredFacing is returned.
/// Step is given as an integer to allow negative values (step away from the desired facing)
/// </summary>
public static WAngle TickFacing(WAngle facing, WAngle desiredFacing, int step)
public static WAngle TickFacing(WAngle facing, WAngle desiredFacing, WAngle step)
{
var leftTurn = (facing - desiredFacing).Angle;
var rightTurn = (desiredFacing - facing).Angle;
if (leftTurn < step || rightTurn < step)
if (leftTurn < step.Angle || rightTurn < step.Angle)
return desiredFacing;
return rightTurn < leftTurn ? new WAngle(facing.Angle + step) : new WAngle(facing.Angle - step);
return rightTurn < leftTurn ? facing + step : facing - step;
}
/// <summary>