示例#1
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");
            }
        }
    }
示例#2
0
    public void Continue_no(bool call_defeat_screen)
    {
        if (my_game_uGUI.show_debug_messages)
        {
            Debug.Log("Continue_no()");
        }

        if (call_defeat_screen)
        {
            Time.timeScale = initial_time_scale;
            can_take_input = false;
        }

        if (my_game_master.if_player_not_continue_selected == game_master.if_player_not_continue.restart_from_W1_Stage_1)
        {
            if (my_game_uGUI.show_debug_messages)
            {
                Debug.Log("Reset_all_worlds");
            }

            if (my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token)
            {
                my_game_master.current_continue_tokens[my_game_master.current_profile_selected] = my_game_master.start_continue_tokens;
            }

            my_game_master.Reset_all_worlds();
        }
        else if (my_game_master.if_player_not_continue_selected == game_master.if_player_not_continue.restart_from_current_world_Stage_1)
        {
            if (my_game_uGUI.show_debug_messages)
            {
                Debug.Log("Reset_current_world if the playar not have already completed it");
            }
            if (my_game_master.current_world[my_game_master.current_profile_selected] == my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected])
            {
                my_game_master.Reset_current_world(my_game_master.current_world[my_game_master.current_profile_selected], true);
                my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected] = my_game_master.current_world[my_game_master.current_profile_selected];
                my_game_master.play_this_stage_to_progress_in_the_game_stage[my_game_master.current_profile_selected] = 0;
            }
        }
        else if (my_game_master.if_player_not_continue_selected == game_master.if_player_not_continue.restart_from_current_world_and_current_stage)
        {
            if (my_game_uGUI.show_debug_messages)
            {
                Debug.Log("restart from here");
            }
        }

        if (my_game_master.when_restart_selected == game_master.when_restart.give_lives_after_countdown)
        {
            my_game_master.InterrupCurrentCountDown();
            my_game_master.Set_date_countdown(false);
        }

        //my_game_master.current_lives[my_game_master.current_profile_selected] = my_game_master.if_not_continue_restart_with_lives;

        my_game_master.refresh_stage_and_world_screens = true;
        my_game_master.Save(my_game_master.current_profile_selected);

        this.gameObject.SetActive(false);

        if (call_defeat_screen && (my_game_master.lose_lives_selected == game_master.lose_lives.in_game))
        {
            my_game_uGUI.Defeat();
        }
    }