Remove Util.QuantizeFacing from trait code.

This commit is contained in:
Paul Chote
2016-01-14 21:18:56 +00:00
parent 275be64f05
commit e46fc644c1
3 changed files with 20 additions and 3 deletions

View File

@@ -42,12 +42,17 @@ namespace OpenRA.Mods.Common.Traits
return orientation;
// Map yaw to the closest facing
var facing = Util.QuantizeFacing(orientation.Yaw.Angle / 4, facings) * (256 / facings);
var facing = QuantizeFacing(orientation.Yaw.Angle / 4, facings);
// Roll and pitch are always zero if yaw is quantized
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
}
public int QuantizeFacing(int facing, int facings)
{
return Util.QuantizeFacing(facing, facings) * (256 / facings);
}
public object Create(ActorInitializer init) { return new BodyOrientation(init, this); }
}
@@ -97,5 +102,15 @@ namespace OpenRA.Mods.Common.Traits
{
return info.QuantizeOrientation(orientation, quantizedFacings.Value);
}
public int QuantizeFacing(int facing)
{
return info.QuantizeFacing(facing, quantizedFacings.Value);
}
public int QuantizeFacing(int facing, int facings)
{
return info.QuantizeFacing(facing, facings);
}
}
}