(965c31410) v0.10.4.0

This commit is contained in:
Joonas Rikkonen
2020-07-30 13:00:09 +03:00
parent eeac247a8e
commit 4978af3d60
539 changed files with 45803 additions and 25359 deletions
@@ -656,10 +656,11 @@ namespace Barotrauma
public static List<Vector2[]> GenerateJaggedLine(Vector2 start, Vector2 end, int iterations, float offsetAmount)
{
List<Vector2[]> segments = new List<Vector2[]>();
List<Vector2[]> segments = new List<Vector2[]>
{
new Vector2[] { start, end }
};
segments.Add(new Vector2[] { start, end });
for (int n = 0; n < iterations; n++)
{
for (int i = 0; i < segments.Count; i++)
@@ -830,6 +831,31 @@ namespace Barotrauma
return (float)Math.Pow(f, p);
}
/// <summary>
/// Converts the alignment to a vector where -1,-1 is the top-left corner, 0,0 the center and 1,1 bottom-right
/// </summary>
public static Vector2 ToVector2(this Alignment alignment)
{
Vector2 vector = new Vector2(0.0f,0.0f);
if (alignment.HasFlag(Alignment.Left))
{
vector.X = -1.0f;
}
else if (alignment.HasFlag(Alignment.Right))
{
vector.X = 1.0f;
}
if (alignment.HasFlag(Alignment.Top))
{
vector.Y = -1.0f;
}
else if (alignment.HasFlag(Alignment.Bottom))
{
vector.Y = 1.0f;
}
return vector;
}
/// <summary>
/// Rotates a point in 2d space around another point.
/// Modified from: