Exemple #1
0
    //build the tiles
    public void BuildBoardTiles()
    {
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                //define
                GameObject newTile;

                newTile = Instantiate(tileBase, new Vector3(i * offset, j * offset, 0.0f), Quaternion.identity);
                newTile.transform.SetParent(tileParent.transform);
                newTile.name = "Tile " + i + ", " + j;
                newTile.GetComponent <TileBehavior>().SetGripPos(i, j);
                newTile.tag = TileTag;
                board.boardTiles.Add(newTile.GetComponent <TileBehavior>());
            }
        }
        board.BuildConnections();
    }