private void OrganizeGameBoard() //Shuffles the position of card types and organizes them { Vector3 startPos = originalCard.transform.position; int[] numbers = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; int counter = 0; numbers = ShuffleArray(numbers); gameData.SetIDArray(numbers); for (int i = 0; i < gridCols; i++) { for (int j = 0; j < gridRows; j++) { MainCard card; if (i == 0 && j == 0) { card = originalCard; } else { card = Instantiate(originalCard, gameArea.transform) as MainCard; } int index = j * gridCols + i; int id = numbers[index]; card.ChangeSprite(id, imgs[id]); save.AcquireData(counter); gameData.AddToCardList(card); counter++; float posX = (offSetX * i) + startPos.x; float posY = (offSetY * j) + startPos.y; card.transform.position = new Vector3(posX, posY, startPos.z); } } }