private void GetNewDirection(ref int dirRow, ref int dirCol)
{
int[] directionRow = { 1, 1, 1, 0, -1, -1, -1, 0 };
int[] directionCol = { 1, 0, -1, -1, -1, 0, 1, 1 };
int currDirection = 0;
for (int i = 0; i < DirectionsCount; i++)
{
if (directionRow[i] == dirRow && directionCol[i] == dirCol)
{
currDirection = i;
break;
}
}
if (currDirection == DirectionsCount - 1)
{
dirRow = directionRow[0];
dirCol = directionCol[0];
return;
}
dirRow = directionRow[currDirection + 1];
dirCol = directionCol[currDirection + 1];
}