I’m doing a puzzle style game to reorder the numbers. I can not write the function to mix the cards. When I press “Space” the situation does not change, they are not mixed.
void Shuffle()
{
for (int x = 0; x < size; x++)
{
for (int y = 0; y < size; y++)
{
Block tmp = blocks[y, x];
int k = Random.Range(x, size);
int z = Random.Range(y, size);
blocks[y, x] = blocks[z, k];
blocks[y, x].transform.position = blocks[z, k].transform.position;
blocks[k, z] = tmp;
blocks[k, z].transform.position = tmp.transform.position;
}
}
}