Exemple #1
0
    void Update()
    {
        //If you are not clicking then button_pressed equals false
        if (Input.GetMouseButton(0) == false)
        {
            button_pressed = false;
        }

        //If a button is pressed run the method in the brackets
        button_house.onClick.AddListener(House_Button);
        button_road.onClick.AddListener(Road_Button);
        button_warehouse.onClick.AddListener(Warehouse_Button);
        button_market_stall.onClick.AddListener(Market_Stall_Button);

        button_forestry.onClick.AddListener(Forestry_Button);
        button_mine.onClick.AddListener(Mine_Button);
        button_farm.onClick.AddListener(Farm_Button);

        button_collect_all.onClick.AddListener(Collect_All_Button);
        button_collect_wood.onClick.AddListener(Collect_Wood_Button);
        button_collect_stone.onClick.AddListener(Collect_Stone_Button);
        button_collect_iron.onClick.AddListener(Collect_Iron_Button);

        button_market_trade.onClick.AddListener(Market_Trade_Button);
        button_politics.onClick.AddListener(Politics_Button);
        button_inventory.onClick.AddListener(Inventory_Button);
        button_data.onClick.AddListener(Data_Button);
        button_bulldoze.onClick.AddListener(Bulldoze_Button);

        general_buildings_button.onClick.AddListener(General_Buildings_Button);
        utility_buildings_button.onClick.AddListener(Utility_Buildings_Button);
        resource_buildings_button.onClick.AddListener(Resource_Buildings_Button);
        resource_collection_button.onClick.AddListener(Resource_Collection_Button);
        market_trade_button.onClick.AddListener(Market_Trade_Button);
        politics_button.onClick.AddListener(Politics_Button);

        //Calls methods if buttons are pressed
        button_increase_builder.onClick.AddListener(Builder_Increase_Button);
        button_decrease_builder.onClick.AddListener(Builder_Decrease_Button);
        button_increase_forester.onClick.AddListener(Forester_Increase_Button);
        button_decrease_forester.onClick.AddListener(Forester_Decrease_Button);
        button_increase_miner.onClick.AddListener(Miner_Increase_Button);
        button_decrease_miner.onClick.AddListener(Miner_Decrease_Button);
        button_increase_farmer.onClick.AddListener(Farmer_Increase_Button);
        button_decrease_farmer.onClick.AddListener(Farmer_Decrease_Button);
        button_increase_trader.onClick.AddListener(Trader_Increase_Button);
        button_decrease_trader.onClick.AddListener(Trader_Decrease_Button);

        //Changes Text to the type plus the amount in storage
        //Converts the data obtained to a string
        text_wood.text  = ("Wood: " + data_manager_script.Check_Resources(1));
        text_stone.text = ("Stone: " + data_manager_script.Check_Resources(2));
        text_iron.text  = ("Iron: " + data_manager_script.Check_Resources(4));

        text_income.text     = ("Income: " + data_manager_script.Check_Total_Income());
        text_gold.text       = ("Gold: " + data_manager_script.Check_Resources(0));
        text_food.text       = ("Food: " + data_manager_script.Check_Resources(3));
        text_population.text = ("Population: " + data_manager_script.Check_Pop_Total());
        text_homeless.text   = ("Homeless " + data_manager_script.Get_Homeless());

        //Get the total number of citizens without jobs
        text_unemployed.text = ("Unemployed: " + data_manager_script.Get_Unemployed());
        //Changes the text to total employed / total jobs for each specific job
        text_builder.text  = ("Builder: " + (data_manager_script.Check_Total_Employed(4) + "/" + data_manager_script.Check_Jobs(4)));
        text_forester.text = ("Forester: " + data_manager_script.Check_Total_Employed(0) + "/" + data_manager_script.Check_Jobs(0));
        text_miner.text    = ("Miner: " + data_manager_script.Check_Total_Employed(1) + "/" + data_manager_script.Check_Jobs(1));
        text_farmer.text   = ("Farmer: " + data_manager_script.Check_Total_Employed(2) + "/" + data_manager_script.Check_Jobs(2));
        text_trader.text   = ("Trader: " + data_manager_script.Check_Total_Employed(3) + "/" + data_manager_script.Check_Jobs(3));
    }