public void UpdateBoardVisuals()
    {
        // Clear old visuals
        foreach (GeneralManager.GamePiece piece in GeneralManager.gameBoard.whitePieces)
        {
            if (piece.visual != null)
            {
                Destroy(piece.visual.gameObject);
            }
        }

        foreach (GeneralManager.GamePiece piece in GeneralManager.gameBoard.blackPieces)
        {
            if (piece.visual != null)
            {
                Destroy(piece.visual.gameObject);
            }
        }

        foreach (GeneralManager.GamePiece piece in GeneralManager.gameBoard.whitePieces)
        {
            piece.visual = Instantiate(MasterDatabase.GetVisualsByID((int)piece.piece, true), GeneralManager.GetTileCenterPos(piece.position), Quaternion.identity).GetComponent <GamePieceVisual>();
            piece.visual.UpdateVisual(team, piece.health, piece.attack, piece.frozen);
        }

        foreach (GeneralManager.GamePiece piece in GeneralManager.gameBoard.blackPieces)
        {
            piece.visual = Instantiate(MasterDatabase.GetVisualsByID((int)piece.piece, false), GeneralManager.GetTileCenterPos(piece.position), Quaternion.identity).GetComponent <GamePieceVisual>();
            piece.visual.UpdateVisual(team, piece.health, piece.attack, piece.frozen);
        }

        manaFieldUI.UpdateManaVisuals(currentMana);

        // Unselect
        curSelected            = new Vector2Int(-1, -1);
        selectorPlane.position = new Vector3(0f, -100f, 0f);
        selectionFieldUI.DisableMenu();
    }
    public void EnableMenu(Vector2Int tileCoord, int mana)
    {
        menuEnabled = true;

        GeneralManager.GamePiece piece = GeneralManager.gameBoard.GetPieceAtPosition(tileCoord);

        if (piece == null || piece.team == ClientManager.team)
        {
            if (piece == null)
            {
                // Nothing on this tile
                if ((ClientManager.team && tileCoord.y == 0) || (!ClientManager.team && tileCoord.y == 7))
                {
                    spawnPawn.SetActive(true);
                }

                spawnPawn.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_0);
            }
            else
            {
                if (piece.piece == GeneralManager.GamePieceEnum.Pawn)
                {
                    upgradePawn1.SetActive(true);
                    upgradePawn2.SetActive(true);
                    upgradePawn3.SetActive(true);
                    upgradePawn4.SetActive(true);

                    upgradePawn1.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_2_1);
                    upgradePawn2.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_2_2);
                    upgradePawn3.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_2_3);
                    upgradePawn4.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_2_4);
                }
                else
                {
                    if (piece.piece != GeneralManager.GamePieceEnum.King)
                    {
                        upgradeAtt.SetActive(true);
                        upgradeDef.SetActive(true);

                        upgradeAtt.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_5);
                        upgradeDef.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_4);
                    }
                    else
                    {
                        healKing.SetActive(true);

                        healKing.GetComponent <Button>().interactable = (mana >= GeneralManager.MANA_COST_3);
                    }
                }

                // Possible movements
                int cost = (piece.piece == GeneralManager.GamePieceEnum.Pawn) ? GeneralManager.MANA_COST_1_0 : GeneralManager.MANA_COST_1_1;

                if (!piece.frozen && mana >= cost)
                {
                    // Movement indicator
                    currentPossibleMovements = GeneralManager.gameBoard.GetAvailableMovePositions(ClientManager.team, piece);

                    for (int y = 0; y < GeneralManager.GAME_BOARD_SIZE; y++)
                    {
                        for (int x = 0; x < GeneralManager.GAME_BOARD_SIZE; x++)
                        {
                            if (currentPossibleMovements[x, y])
                            {
                                GameObject indicator = GetPooledMoveIndicator();

                                if (indicator != null)
                                {
                                    indicator.transform.position = GeneralManager.GetTileCenterPos(new Vector2Int(x, y));
                                    indicator.SetActive(true);
                                }
                                else
                                {
                                    indicator = Instantiate(canMoveIndicatorPrefab, GeneralManager.GetTileCenterPos(new Vector2Int(x, y)), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
                                    canMoveIndicators.Add(indicator);
                                }

                                GeneralManager.GamePiece pAtPos = GeneralManager.gameBoard.GetPieceAtPosition(new Vector2Int(x, y));
                                if (pAtPos != null && pAtPos.team != ClientManager.team)
                                {
                                    indicator.GetComponent <MoveIndicator>().renderer.material = attackIndicatorMat;
                                }
                            }
                        }
                    }
                }
            }
        }
    }