Пример #1
0
    public void Update_me()
    {
        if (my_game_master == null)
        {
            if (game_master.game_master_obj)
            {
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            }
        }

        if (my_game_master.show_star_score)
        {
            my_stars.GetChild(0).GetComponent <TextMeshProUGUI>().text = my_game_master.stars_total_score[my_game_master.current_profile_selected].ToString();
        }

        if (!my_game_master.infinite_lives)
        {
            my_lives.GetChild(2).GetComponent <TextMeshProUGUI>().text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();

            lives_timer.gameObject.SetActive(my_game_master.CheckIfStatExtraliveCountdown());

            if ((my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token) && (!my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled))
            {
                my_tokens.GetChild(0).GetComponent <TextMeshProUGUI>().text = my_game_master.current_continue_tokens[my_game_master.current_profile_selected].ToString();
            }
        }
        my_virtual_money.GetChild(0).GetComponent <TextMeshProUGUI>().text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString("N0");
    }
Пример #2
0
    public void Select_this_profile(int profile_slot)
    {
        if (profile_slot != my_game_master.current_profile_selected)
        {
            if (!my_game_master.infinite_lives)
            {
                my_game_master.Check_if_interrupt_countdown();
            }

            my_game_master.current_profile_selected = profile_slot;
            PlayerPrefs.SetInt("last_profile_used", my_game_master.current_profile_selected);
            my_manage_menu_uGUI.update_world_and_stage_screen = true;
            my_game_master.Load(my_game_master.current_profile_selected);
            //check countdown
            my_game_master.timerStatus = game_master.TimerStatus.Off;
            my_game_master.CheckIfStatExtraliveCountdown();

            Show_current_slot_selected();
        }
    }
Пример #3
0
    public void Update_lives(int live_variation)
    {
        bool dead = false;

        if (my_game_master)
        {
            if (!my_game_master.infinite_lives)
            {
                my_game_master.current_lives[my_game_master.current_profile_selected] += live_variation;
                if (show_debug_messages)
                {
                    Debug.Log("lives = " + my_game_master.current_lives[my_game_master.current_profile_selected]);
                }


                if (my_game_master.current_lives[my_game_master.current_profile_selected] > my_game_master.live_cap)
                {
                    my_game_master.current_lives[my_game_master.current_profile_selected] = my_game_master.live_cap;
                }
                else if (my_game_master.current_lives[my_game_master.current_profile_selected] <= 0)
                {
                    my_game_master.current_lives[my_game_master.current_profile_selected] = 0;
                    dead = true;
                }
                else
                {
                    dead = false;
                }

                lives_timer.gameObject.SetActive(my_game_master.CheckIfStatExtraliveCountdown());

                my_game_master.Save(my_game_master.current_profile_selected);

                if (dead)
                {
                    my_game_master.InterrupCurrentCountDown();

                    if (my_game_master.lose_lives_selected == game_master.lose_lives.in_game)
                    {
                        if (my_game_master.continue_rule_selected != game_master.continue_rule.never_continue)
                        {                                //ask if you want continue
                            if (my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled)
                            {
                                my_continue_window.Start_me_with_ad(my_game_master.my_ads_master.ads_when_continue_screen_appear);
                            }
                            else
                            {
                                my_continue_window.Start_me();
                            }
                        }
                        else
                        {                                //ultimate lose
                            Defeat();
                        }
                    }
                    else if (my_game_master.lose_lives_selected == game_master.lose_lives.when_show_lose_screen)
                    {
                        if (my_game_master.continue_rule_selected != game_master.continue_rule.never_continue)
                        {                                //ask if you want continue
                            if (my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled)
                            {
                                my_continue_window.Start_me_with_ad(my_game_master.my_ads_master.ads_when_continue_screen_appear);
                            }
                            else
                            {
                                my_continue_window.Start_me();
                            }
                        }
                    }
                }
                else
                {
                    //player continue to play from check point in this state or after new live animation, etcetera...
                    //these behavior are managed from yours scripts and not from this generic gui system
                }

                lives_count.text             = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();
                lose_screen_lives_count.text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();
            }
        }
        else
        {
            if (show_debug_warnings)
            {
                Debug.LogWarning("You must start the game from Home scene in order to keep track of lives");
            }
        }
    }