for (int i = 0; i < Adjacency.Length; i++)
{
Vector2Int curr = Adjacency[i];
Vector2Int position = curr + _tile;
if (position.x >= width || position.y >= height || position.x < 0 || position.y < 0)
continue;
byte adjacentTileType = (byte)(_tiledata & (byte.MaxValue << (i * 8)));
int oppositeSide = i + 2;
oppositeSide = oppositeSide > 3 ? oppositeSide - 4 : oppositeSide;
uint shiftedAdjacentTile = (uint)((int)adjacentTileType << (oppositeSide * 8));
uint shiftedMask = (uint)(byte.MaxValue << (oppositeSide * 8));
// one function would have stuff to update tiles based on these calculations, another to check if they are valid, some other ones will be added
}
for (int i = 0; i < Adjacency.Length; i++)
{
Vector2Int curr = Adjacency[i];
Vector2Int position = curr + _tile;
if (position.x >= width || position.y >= height || position.x < 0 || position.y < 0)
continue;
byte adjacentTileType = (byte)(_tiledata & (byte.MaxValue << (i * 8)));
int oppositeSide = i + 2;
oppositeSide = oppositeSide > 3 ? oppositeSide - 4 : oppositeSide;
uint shiftedAdjacentTile = (uint)((int)adjacentTileType << (oppositeSide * 8));
uint shiftedMask = (uint)(byte.MaxValue << (oppositeSide * 8));
// one function would have stuff to update tiles based on these calculations, another to check if they are valid, some other ones will be added
}