Add ScaleFactor to math, since some trap locations are too close to others

rendering v2.6
Liza 2023-02-07 21:28:01 +01:00
parent 136774eb71
commit 9263b9edfc
2 changed files with 6 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<LangVersion>11.0</LangVersion>
<Version>2.5</Version>
<Version>2.6</Version>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@ -4,13 +4,18 @@ namespace Pal.Common
{
public class PalaceMath
{
private static readonly Vector3 ScaleFactor = new Vector3(5);
public static bool IsNearlySamePosition(Vector3 a, Vector3 b)
{
a *= ScaleFactor;
b *= ScaleFactor;
return (int)a.X == (int)b.X && (int)a.Y == (int)b.Y && (int)a.Z == (int)b.Z;
}
public static int GetHashCode(Vector3 v)
{
v *= ScaleFactor;
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
}
}