Remove obsolete functions from Traits.Util.
This commit is contained in:
@@ -84,31 +84,11 @@ namespace OpenRA.Traits
|
|||||||
return a / step;
|
return a / step;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float2 RotateVectorByFacing(float2 v, int facing, float ecc)
|
|
||||||
{
|
|
||||||
var angle = (facing / 256f) * (2 * (float)Math.PI);
|
|
||||||
var sinAngle = (float)Math.Sin(angle);
|
|
||||||
var cosAngle = (float)Math.Cos(angle);
|
|
||||||
|
|
||||||
return new float2(
|
|
||||||
(cosAngle * v.X + sinAngle * v.Y),
|
|
||||||
ecc * (cosAngle * v.Y - sinAngle * v.X));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PPos CenterOfCell(CPos loc)
|
|
||||||
{
|
|
||||||
return loc.ToPPos() + new PVecInt(Game.CellSize / 2, Game.CellSize / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WPos BetweenCells(CPos from, CPos to)
|
public static WPos BetweenCells(CPos from, CPos to)
|
||||||
{
|
{
|
||||||
return WPos.Lerp(from.CenterPosition, to.CenterPosition, 1, 2);
|
return WPos.Lerp(from.CenterPosition, to.CenterPosition, 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int2 AsInt2(this int[] xs) { return new int2(xs[0], xs[1]); }
|
|
||||||
public static float2 RelOffset(this int[] offset) { return new float2(offset[0], offset[1]); }
|
|
||||||
public static float2 AbsOffset(this int[] offset) { return new float2(offset.ElementAtOrDefault(2), offset.ElementAtOrDefault(3)); }
|
|
||||||
|
|
||||||
public static Activity SequenceActivities(params Activity[] acts)
|
public static Activity SequenceActivities(params Activity[] acts)
|
||||||
{
|
{
|
||||||
return acts.Reverse().Aggregate(
|
return acts.Reverse().Aggregate(
|
||||||
@@ -133,11 +113,6 @@ namespace OpenRA.Traits
|
|||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color ArrayToColor(int[] x) { return Color.FromArgb(x[0], x[1], x[2]); }
|
|
||||||
|
|
||||||
[Obsolete("Use ToCPos() method", true)]
|
|
||||||
public static int2 CellContaining(float2 pos) { return (1f / Game.CellSize * pos).ToInt2(); }
|
|
||||||
|
|
||||||
/* pretty crap */
|
/* pretty crap */
|
||||||
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> ts, Thirdparty.Random random)
|
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> ts, Thirdparty.Random random)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ namespace OpenRA.Mods.RA
|
|||||||
this.self = init.self;
|
this.self = init.self;
|
||||||
|
|
||||||
TopLeft = init.Get<LocationInit, CPos>();
|
TopLeft = init.Get<LocationInit, CPos>();
|
||||||
var ppos = init.Contains<CenterLocationInit>() ? init.Get<CenterLocationInit, PPos>() : Util.CenterOfCell(TopLeft);
|
CenterPosition = init.Contains<CenterLocationInit>() ? init.Get<CenterLocationInit, PPos>().ToWPos(0) : TopLeft.CenterPosition;
|
||||||
CenterPosition = ppos.ToWPos(0);
|
|
||||||
Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 128;
|
Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 128;
|
||||||
|
|
||||||
var speed = init.Contains<HuskSpeedInit>() ? init.Get<HuskSpeedInit, int>() : 0;
|
var speed = init.Contains<HuskSpeedInit>() ? init.Get<HuskSpeedInit, int>() : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user