Exemple #1
0
    /// <summary>
    /// Starts a new game with current settings (public fields).
    /// Note: Dimensions of all board items are taken from the first one (boardItems[0]).
    /// </summary>
    void NewGame()
    {
        // Make new board (logic).
        match3.MakeNewBoard(boardSizeX, boardSizeY, boardItems.Length);

        // Init game view.
        boardAll = new BoardItem[boardSizeX, boardSizeY];
        itemSize = boardItems[0].renderer.bounds.size;
        Vector3 boardSize = new Vector3(boardSizeX * itemSize.x + ((boardSizeX - 1) * itemSpacing.x),
                                        boardSizeY * itemSize.y + ((boardSizeY - 1) * itemSpacing.y), itemSize.z);

        boardCenter = boardSize / 2.0f;
        RefreshBoard();
    }