Esempio n. 1
0
    public void activate()
    {
        //================================================================
        // GET VARIABLES
        //================================================================
        //Button
        clicking_button = transform.GetComponent <Button>();

        //Inner text of the button
        inner_text = new List <Text>();
        Text[] t = transform.GetComponentsInChildren <Text>();
        foreach (Text t_aux in t)
        {
            inner_text.Add(t_aux);
        }

        //Find economy Manager
        economyManager = GameObject.FindWithTag("EconomyManager").GetComponent <Economy_manager>();

        //================================================================

        //Function to activate when pressed
        clicking_button.onClick.AddListener(purchase);

        //Set personal tag
        gameObject.tag = "IncrementalItem";

        //Enable button
        clicking_button.interactable = true;

        //Update the text for the first time
        inner_text[0].text = object_name;
        inner_text[1].text = "" + actual_cost.ToString("F1");
        inner_text[2].text = "" + number_of_elements;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        //================================================================
        // GET VARIABLES
        //================================================================
        //Button
        clicking_button = transform.GetComponent <Button>();

        //Find economy Manager
        economyManager = GameObject.FindWithTag("EconomyManager").GetComponent <Economy_manager>();
        //================================================================

        //Function to listen to when button is pressed
        clicking_button.onClick.AddListener(add_wave);
    }