Esempio n. 1
0
    public void Next()
    {
        if (my_game_master)
        {
            my_game_master.Gui_sfx(my_game_master.tap_sfx);
            //my_game_master.Unlink_me_to_camera();

            if (n_stage < my_game_master.total_stages_in_world_n[n_world - 1])         //there are more stages in this world to play
            {
                int next_world = n_world;

                if (my_game_master.use_same_scene_for_all_stages_in_the_same_world)
                {
                    my_game_master.current_stage++;

                    if (my_game_master.show_loading_screen)
                    {
                        loading_screen.gameObject.SetActive(true);
                    }

                    SceneManager.LoadScene("W" + next_world.ToString() + "_Stage_" + 1);
                }
                else
                {
                    int next_stage = n_stage + 1;
                    if (show_debug_messages)
                    {
                        Debug.Log("there are more stage in this world, so go to " + "W" + next_world.ToString() + "_Stage_" + next_stage.ToString());
                    }
                    if (my_game_master.show_loading_screen)
                    {
                        loading_screen.gameObject.SetActive(true);
                    }
                    SceneManager.LoadScene("W" + next_world.ToString() + "_Stage_" + next_stage.ToString());
                }
            }
            else             //go to next word if exist
            {
                if (n_world < my_game_master.total_stages_in_world_n.Length)
                {
                    if (my_game_master.world_playable[my_game_master.current_profile_selected][n_world] && my_game_master.stage_playable[my_game_master.current_profile_selected][n_world, 0])
                    {
                        int next_world = n_world + 1;
                        if (show_debug_messages)
                        {
                            Debug.Log("go to next world " + ("W" + next_world.ToString() + "_Stage_1"));
                        }
                        if (my_game_master.show_loading_screen)
                        {
                            loading_screen.gameObject.SetActive(true);
                        }
                        SceneManager.LoadScene("W" + next_world.ToString() + "_Stage_1");
                    }
                    else
                    {
                        Go_to_stage_screen();
                    }
                }
                else                 //this was the last stage, so...
                {
                    my_game_master.All_stages_solved();
                }
            }
        }
        else
        {
            if (show_debug_warnings)
            {
                Debug.LogWarning("You must start the game from Home scene in order to use this button");
            }
        }
    }