Add ScaleFactor to math, since some trap locations are too close to others
This commit is contained in:
parent
136774eb71
commit
9263b9edfc
@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Version>2.5</Version>
|
<Version>2.6</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -4,13 +4,18 @@ namespace Pal.Common
|
|||||||
{
|
{
|
||||||
public class PalaceMath
|
public class PalaceMath
|
||||||
{
|
{
|
||||||
|
private static readonly Vector3 ScaleFactor = new Vector3(5);
|
||||||
|
|
||||||
public static bool IsNearlySamePosition(Vector3 a, Vector3 b)
|
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;
|
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)
|
public static int GetHashCode(Vector3 v)
|
||||||
{
|
{
|
||||||
|
v *= ScaleFactor;
|
||||||
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
|
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user