This commit is contained in:
monitor1394
2022-05-22 22:17:38 +08:00
parent 003f4da9de
commit bafe032bb9
391 changed files with 3718 additions and 2774 deletions

View File

@@ -7,18 +7,18 @@ namespace XUGL
{
public static bool IsValueEqualsColor(Color32 color1, Color32 color2)
{
return color1.a == color2.a
&& color1.b == color2.b
&& color1.g == color2.g
&& color1.r == color2.r;
return color1.a == color2.a &&
color1.b == color2.b &&
color1.g == color2.g &&
color1.r == color2.r;
}
public static bool IsValueEqualsColor(Color color1, Color color2)
{
return color1.a == color2.a
&& color1.b == color2.b
&& color1.g == color2.g
&& color1.r == color2.r;
return color1.a == color2.a &&
color1.b == color2.b &&
color1.g == color2.g &&
color1.r == color2.r;
}
public static bool IsValueEqualsString(string str1, string str2)
@@ -32,21 +32,21 @@ namespace XUGL
public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)
{
return v1.x == v2.x
&& v1.y == v2.y;
return v1.x == v2.x &&
v1.y == v2.y;
}
public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)
{
return v1.x == v2.x
&& v1.y == v2.y
&& v1.z == v2.z;
return v1.x == v2.x &&
v1.y == v2.y &&
v1.z == v2.z;
}
public static bool IsValueEqualsVector3(Vector3 v1, Vector2 v2)
{
return v1.x == v2.x
&& v1.y == v2.y;
return v1.x == v2.x &&
v1.y == v2.y;
}
public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)
@@ -60,8 +60,7 @@ namespace XUGL
for (int i = 0; i < list1.Count; i++)
{
if (list1[i] == null && list2[i] == null)
{
}
{ }
else
{
if (list1[i] != null)
@@ -81,25 +80,25 @@ namespace XUGL
public static bool IsClearColor(Color32 color)
{
return color.a == 0
&& color.b == 0
&& color.g == 0
&& color.r == 0;
return color.a == 0 &&
color.b == 0 &&
color.g == 0 &&
color.r == 0;
}
public static bool IsClearColor(Color color)
{
return color.a == 0
&& color.b == 0
&& color.g == 0
&& color.r == 0;
return color.a == 0 &&
color.b == 0 &&
color.g == 0 &&
color.r == 0;
}
public static bool IsZeroVector(Vector3 pos)
{
return pos.x == 0
&& pos.y == 0
&& pos.z == 0;
return pos.x == 0 &&
pos.y == 0 &&
pos.z == 0;
}
public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)
@@ -110,7 +109,7 @@ namespace XUGL
}
public static void GetBezierList(ref List<Vector3> posList, Vector3 sp, Vector3 ep,
Vector3 lsp, Vector3 nep, float smoothness = 2f, float k = 2.0f)
Vector3 lsp, Vector3 nep, float smoothness = 2f, float k = 2.0f)
{
float dist = Mathf.Abs(sp.x - ep.x);
Vector3 cp1, cp2;
@@ -129,8 +128,8 @@ namespace XUGL
if (nep == ep) cp2 = ep;
else cp2 = ep - (nep - sp).normalized * diff;
dist = Vector3.Distance(sp, ep);
int segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
if (segment < 1) segment = (int)(dist / 0.5f);
int segment = (int) (dist / (smoothness <= 0 ? 2f : smoothness));
if (segment < 1) segment = (int) (dist / 0.5f);
if (segment < 4) segment = 4;
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
if (posList.Count < 2)
@@ -150,7 +149,7 @@ namespace XUGL
Vector3 cp2 = sp + dist / k * dir * (k - 1);
cp1.x = sp.x;
cp2.x = ep.x;
int segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
int segment = (int) (dist / (smoothness <= 0 ? 2f : smoothness));
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
if (posList.Count < 2)
{
@@ -165,7 +164,7 @@ namespace XUGL
List<Vector3> list = new List<Vector3>();
for (int i = 0; i < segment; i++)
{
list.Add(GetBezier(i / (float)segment, sp, cp, ep));
list.Add(GetBezier(i / (float) segment, sp, cp, ep));
}
list.Add(ep);
return list;
@@ -181,7 +180,7 @@ namespace XUGL
}
for (int i = 0; i < segment; i++)
{
posList.Add((GetBezier2(i / (float)segment, sp, cp, cp2, ep)));
posList.Add((GetBezier2(i / (float) segment, sp, cp, cp2, ep)));
}
posList.Add(ep);
}