added Distance function, quick fix for Neighbors function
This commit is contained in:
@@ -39,3 +39,11 @@ void AHexTile::FillCornersArray()
|
||||
Corners.Emplace(Corner(i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
int32 AHexTile::Distance(AHexTile* ToHex)
|
||||
{
|
||||
int32 CubeS1 = -this->Q - this->R;
|
||||
int32 CubeS2 = -ToHex->Q - ToHex->R;
|
||||
|
||||
return (abs(this->Q - ToHex->Q) + abs(this->R - ToHex->R) + abs(CubeS1 - CubeS2)) / 2;
|
||||
}
|
||||
Reference in New Issue
Block a user