public void Update()
 {
     miliciaPop.enableUpAction();
     miliciaPop.enableDownAction();
     foodPop.enableUpAction();
     foodPop.enableDownAction();
     woodPop.enableUpAction();
     woodPop.enableDownAction();
     ironPop.enableUpAction();
     ironPop.enableDownAction();
     goldPop.enableUpAction();
     goldPop.enableDownAction();
     manaPop.enableUpAction();
     manaPop.enableDownAction();
     updateUI();
 }
Пример #2
0
    private void updateUI()
    {
        if (titleText.text != GameVariables.batimentSelectionne.nomBatiment)
        {
            initUI();
        }

        //Update Effectifs if Nessecary
        if (buildingPopulationManager.gameObject.activeSelf == true)
        {
            buildingPopulationManager.enableUpAction();
            buildingPopulationManager.enableDownAction();

            //Update Avaible Pop
            int avaiblePopCounter = GameVariables.listHabitant.Count;

            if (avaiblePopCounter == 0)
            { //On désac le bouton + (plus de pop dispo)
                buildingPopulationManager.disableUpAction();
            }

            //Update Bat Pop
            int batPopCounter = GameVariables.batimentSelectionne.ListHabitants.Count;
            buildingPopulationManager.setPopCounter(batPopCounter);
            if (batPopCounter == 0)
            { //On désac le bouton - (pas de pop a retirer)
                buildingPopulationManager.disableDownAction();
            }
            if (batPopCounter == GameVariables.batimentSelectionne.nbrMaxHab)
            { //On désac le bouton + (plus de place pour pop supp)
                buildingPopulationManager.disableUpAction();
            }
        }

        //Update Prod if Nessecary
        if (buildingProdUI.gameObject.activeSelf == true)
        {
            buildingProdUI.updateProdIcon((GameVariables.batimentSelectionne as BatimentRessource).typeHabitant);
            buildingProdUI.updateCurrentProd((GameVariables.batimentSelectionne as BatimentRessource).getCurrentResourceProd());
            buildingProdUI.updateProdUnit((GameVariables.batimentSelectionne as BatimentRessource).nbSecondBeforeGenerate, "sec");
        }

        //Update Upgrade if Nessecary
        if (buildingUpgradeUI.gameObject.activeSelf == true)
        {
            //MAJ des couts d'upgrade
            buildingUpgradeUI.updateFoodCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMeat);
            buildingUpgradeUI.updateWoodCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceWood);
            buildingUpgradeUI.updateIronCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceIron);
            buildingUpgradeUI.updateGoldCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceGold);
            buildingUpgradeUI.updateManaCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMana);


            buildingUpgradeUI.setUpgradeButtonActive(true); //De base upgrade possible
            if (GameVariables.nbMeat < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMeat ||
                GameVariables.nbWood < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceWood ||
                GameVariables.nbIron < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceIron ||
                GameVariables.nbGold < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceGold ||
                GameVariables.nbMana < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMana)
            {                                                    //Si une ressource manquante
                buildingUpgradeUI.setUpgradeButtonActive(false); //Upgrade imposible
            }
        }
    }