Exemplo n.º 1
0
    /*
     * Makes Avatar tile
     */
    public void MakeAvatarTileCheck()
    {
        if (gameBoard.currentTile)
        {
            // Turn current tile into Avatar
            if (gameBoard.currentTile.GetHasMatched() && gameBoard.currentTile.GetTileType() == TileType.Normal)
            {
                gameBoard.currentTile.SetHasMatched(false);
                currentMatches.Remove(gameBoard.currentTile.gameObject);
                gameBoard.currentTile.GenerateAvatarTile();
            }
            // Turn other tile into Avatar
            else if (gameBoard.currentTile.GetOtherTile())
            {
                if (gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>())
                {
                    GameTileBase otherTile = gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>();

                    if (otherTile.GetHasMatched() && otherTile.GetTileType() == TileType.Normal)
                    {
                        otherTile.SetHasMatched(false);
                        otherTile.GenerateAvatarTile();
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    /*
     * Makes char tile
     *
     */
    public void MakeCharTileCheck()
    {
        if (gameBoard.currentTile)
        {
            // Turn current tile into Char
            if (gameBoard.currentTile.GetHasMatched() && gameBoard.currentTile.GetTileType() == TileType.Normal)
            {
                gameBoard.currentTile.SetHasMatched(false);
                currentMatches.Remove(gameBoard.currentTile.gameObject);

                if (gameBoard.currentTile.swipeDirection == SwipeDirection.Left ||
                    gameBoard.currentTile.swipeDirection == SwipeDirection.Right)
                {
                    gameBoard.currentTile.GenerateCharTile(true);
                }
                else
                {
                    gameBoard.currentTile.GenerateCharTile(false);
                }
            }

            // Turn other tile into Char
            else if (gameBoard.currentTile.GetOtherTile())
            {
                if (gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>())
                {
                    GameTileBase otherTile = gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>();

                    if (otherTile.GetHasMatched() && otherTile.GetTileType() == TileType.Normal)
                    {
                        otherTile.SetHasMatched(false);
                        currentMatches.Remove(gameBoard.currentTile.gameObject);

                        if (gameBoard.currentTile.swipeDirection == SwipeDirection.Left ||
                            gameBoard.currentTile.swipeDirection == SwipeDirection.Right)
                        {
                            gameBoard.currentTile.GenerateCharTile(true);
                        }
                        else
                        {
                            gameBoard.currentTile.GenerateCharTile(false);
                        }
                    }
                }
            }
        }
    }