Example #1
0
    void generateCubes()
    {
        for (int row = 0; row < 9; row++)
        {
            for (int col = 0; col < 9; col++)
            {
                GameObject piece = Instantiate(squarePrefab) as GameObject;

                piece.AddComponent <ClickSquare>();


                gameBoard[row, col] = piece;

                piece.transform.position = new Vector3((col * 4.9f) - 8.2f, (row * -4.9f) + 32.65f, -0.2f);

                piece.name = GetSpaceStringName(row, col);

                PlaceWallColliders(piece);

                piece.transform.SetParent(gameBoardWrapper.transform);

                interfaceController.AddToSpaceMap(piece);

                GameObject highlightPiece = Instantiate(highlightSquarePrefab) as GameObject;


                highlightPiece.transform.position = new Vector3(piece.transform.position.x, piece.transform.position.y, -.19f);
                highlightPiece.transform.SetParent(piece.transform);
                highlightPiece.SetActive(false);
            }
        }
    }