// Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0)) // clicked and released left button
        {
            int meshNumber = GetRayCastMeshNumber();
            //found something correct
            SelectProvince(meshNumber);
        }
        if (Game.haveToStepSimulation || Game.haveToRunSimulation)
        {
            Game.stepSimulation();

            if (topPanel.isActiveAndEnabled)
            {
                topPanel.refresh();
            }
            if (popUnitPanel.isActiveAndEnabled)
            {
                popUnitPanel.refresh();
            }
            if (populationPanel.isActiveAndEnabled)
            {
                populationPanel.refresh();
            }
            if (tradeWindow.isActiveAndEnabled)
            {
                tradeWindow.Refresh();
            }
            if (factoryPanel.isActiveAndEnabled)
            {
                factoryPanel.refresh();
            }
            if (productionWindow.isActiveAndEnabled)
            {
                productionWindow.refresh();
            }
            if (goodsPanel.isActiveAndEnabled)
            {
                goodsPanel.refresh();
            }
            if (inventionsPanel.isActiveAndEnabled)
            {
                inventionsPanel.refresh();
            }
            if (buildPanel.isActiveAndEnabled)
            {
                buildPanel.refresh();
            }
            if (politicsPanel.isActiveAndEnabled)
            {
                politicsPanel.refresh(true);
            }
            if (financePanel.isActiveAndEnabled)
            {
                financePanel.refresh();
            }
        }
        if (Game.haveToStepSimulation)
        {
            Game.haveToStepSimulation = false;
        }

        if (Game.selectedProvince != null)
        {
            provincePanel.UpdateProvinceWindow(Game.selectedProvince);
        }
    }