Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        //search all buttons that you must manage
        total_buttons  = this.transform.childCount;
        profiles_array = new profile_button[total_buttons];
        for (int i = 0; i < total_buttons; i++)
        {
            Transform       temp_childeren = this.transform.GetChild(i);
            profile_manager this_script    = this.GetComponent <profile_manager>();

            if (i < my_game_master.number_of_save_profile_slot_avaibles)
            {
                temp_childeren.gameObject.SetActive(true);
                profiles_array[i] = temp_childeren.GetComponent <profile_button>();
                profiles_array[i].my_profile_manager = this_script;
                profiles_array[i].my_game_master     = my_game_master;
                profiles_array[i].Start_me(i);


                if (my_game_master.this_profile_have_a_save_state_in_it[i])
                {
                    my_game_master.Load(i);

                    Update_this_slot(i);
                }
                else
                {
                    profiles_array[i].Set_off();
                }
            }
            else
            {
                temp_childeren.gameObject.SetActive(false);
            }
        }

        initialized = true;
    }