Esempio n. 1
0
 public void My_padlock()
 {
     if (my_game_master.world_playable[my_game_master.current_profile_selected][my_number])
     {
         my_padlock.enabled = false;
         my_star_need.gameObject.SetActive(false);
     }
     else
     {
         my_padlock.enabled = true;
         if (my_game_master.this_world_is_unlocked_after_selected[my_number] == game_master.this_world_is_unlocked_after.reach_this_star_score)
         {
             if (my_game_master.stars_total_score[my_game_master.current_profile_selected] >= my_game_master.star_score_required_to_unlock_this_world[my_number])
             {
                 my_game_master.world_playable[my_game_master.current_profile_selected][my_number]    = true;
                 my_game_master.stage_playable[my_game_master.current_profile_selected][my_number, 0] = true;
                 my_game_master.Save(my_game_master.current_profile_selected);
                 My_padlock();
             }
             else
             {
                 my_star_need.gameObject.SetActive(true);
                 my_star_need.text = my_game_master.star_score_required_to_unlock_this_world[my_number].ToString();
             }
         }
         else
         {
             my_star_need.gameObject.SetActive(false);
         }
     }
 }
Esempio n. 2
0
    IEnumerator Update_lives_countdown()
    {
        if (current_screen == no_lives_left_screen) //keep update the text only when the page is active
        {
            //if not exist a target time yet, note it now
            if (my_game_master.target_time[my_game_master.current_profile_selected].Year == 0001)
            {
                my_game_master.Set_date_countdown();
                my_game_master.Save(my_game_master.current_profile_selected);
            }

            no_lives_left_countdown.text = my_game_master.Show_how_much_time_left();
            yield return(new WaitForSeconds(1));

            if (my_game_master.current_lives[my_game_master.current_profile_selected] > 0)
            {
                no_lives_left_screen.gameObject.SetActive(false);
                Mark_current_screen(home_screen);
            }
            else
            {
                StartCoroutine(Update_lives_countdown());
            }
        }
    }
Esempio n. 3
0
    void Manage_LivesTimer()
    {
        if (!lives_timer.activeSelf)
        {
            return;
        }

        if (my_game_master.target_time[my_game_master.current_profile_selected].Year == 0001)
        {
            my_game_master.Set_date_countdown(true);
            my_game_master.Save(my_game_master.current_profile_selected);
        }

        lives_timer_text.text = my_game_master.Show_how_much_time_left();

        if (my_game_master.timerStatus == game_master.TimerStatus.done)
        {
            my_game_master.timerStatus = game_master.TimerStatus.Off;
            Update_lives(0);
        }
    }
Esempio n. 4
0
 void Tail_animation()
 {
     //show map tail dots if need
     if (my_tail_dot.Length > 0)
     {
         if (this.gameObject.activeInHierarchy)
         {
             StartCoroutine(Turn_on_this_dot(0, my_game_master.star_score_difference * 0.5f));
         }
         else
         {
             Just_show_tail_on();
             my_game_master.dot_tail_turn_on[my_game_master.current_profile_selected][world_number - 1, stage_number - 1] = true;
             my_game_master.Save(my_game_master.current_profile_selected);
         }
     }
     else
     {
         Remove_padlock();
     }
 }
Esempio n. 5
0
    void Give_the_stuff()
    {
        Debug.Log("Give_the_stuff: " + give_this_selected);
        switch (give_this_selected)
        {
        case give_this.virtual_money:
            my_game_master.current_virtual_money[my_game_master.current_profile_selected] += quantity;

            //if (my_game_master.reward_feedback_after_ad)
            //my_feedback_window.Start_me(my_ico,quantity,my_game_master.virtual_money_name);
            break;

        case give_this.new_live:
            my_game_master.current_lives[my_game_master.current_profile_selected] += quantity;

            //if (my_game_master.reward_feedback_after_ad)
            //my_feedback_window.Start_me(my_ico,quantity,my_game_master.lives_name);
            break;

        case give_this.unlock_world:
            my_game_master.Unlock_this_world(quantity);
            my_game_master.world_purchased[my_game_master.current_profile_selected][quantity] = true;
            my_manage_menu_uGUI.Update_profile_name(true);                    //this update also world and stage screen to show the new world unlock
            break;

        case give_this.continue_token:
            my_game_master.current_continue_tokens[my_game_master.current_profile_selected] += quantity;
            break;

        case give_this.incremental_item:
            my_game_master.incremental_item_current_level[my_game_master.current_profile_selected][my_item_ID]++;
            break;

        case give_this.consumable_item:
            my_game_master.consumable_item_current_quantity[my_game_master.current_profile_selected][my_item_ID]++;
            break;
        }

        my_game_master.Save(my_game_master.current_profile_selected);

        if (my_game_master.show_purchase_feedback)
        {
            my_feedback_window.Start_me(my_ico, quantity, my_name);
        }

        my_store_tabs.Update_buttons_in_windows();
        purchased = true;
    }
Esempio n. 6
0
    private void Update()
    {
        //gain extra lives timer
        if (!lives_timer.gameObject.activeSelf)
        {
            return;
        }

        //if not exist a target time yet, note it now
        if (my_game_master.target_time[my_game_master.current_profile_selected].Year == 0001)
        {
            my_game_master.Set_date_countdown(true);
            my_game_master.Save(my_game_master.current_profile_selected);
        }

        lives_timer_text.text = my_game_master.Show_how_much_time_left();

        if (my_game_master.timerStatus == game_master.TimerStatus.done)
        {
            my_game_master.timerStatus = game_master.TimerStatus.Off;
            Update_me();
        }
    }
Esempio n. 7
0
    public void Create_new_profile(int profile_slot, bool show_cancel_button)
    {
        //copy options settings
        game_master.music_on[profile_slot]     = game_master.music_on[my_game_master.current_profile_selected];
        game_master.music_volume[profile_slot] = game_master.music_volume[my_game_master.current_profile_selected];
        game_master.sfx_on[profile_slot]       = game_master.sfx_on[my_game_master.current_profile_selected];
        game_master.sfx_volume[profile_slot]   = game_master.sfx_volume[my_game_master.current_profile_selected];
        game_master.voice_on[profile_slot]     = game_master.voice_on[my_game_master.current_profile_selected];
        game_master.voice_volume[profile_slot] = game_master.voice_volume[my_game_master.current_profile_selected];
        my_game_master.Save(profile_slot);

        //my_game_master.current_profile_selected = profile_slot;
        Show_current_slot_selected();

        if (my_game_master.require_a_name_for_profiles)
        {
            if (my_game_master.use_pad)
            {
                my_manage_menu_uGUI.current_screen.gameObject.SetActive(false);
                my_manage_menu_uGUI.my_new_profile_pad.My_start(profile_slot, show_cancel_button, profiles_array[profile_slot].gameObject);

                my_manage_menu_uGUI.Mark_this_button(my_manage_menu_uGUI.new_profile_window_pad_target_button);
            }
            else
            {
                my_manage_menu_uGUI.my_new_profile_window.GetComponent <new_profile_window>().My_start(profile_slot, show_cancel_button);
                //my_manage_menu_uGUI.my_new_profile_window.SetActive(true);
                //my_manage_menu_uGUI.my_new_profile_window.GetComponent<new_profile_window>().Focus();
            }
        }
        else
        {
            my_game_master.Create_new_profile("");
            Update_this_slot(profile_slot);
        }
    }
Esempio n. 8
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;
                }
                my_game_master.Save(my_game_master.current_profile_selected);

                if (dead)
                {
                    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");
            }
        }
    }
Esempio n. 9
0
    public void Continue_no(bool call_defeat_screen)
    {
        if (game_uGUI.current_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 (game_uGUI.current_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 (game_uGUI.current_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 (game_uGUI.current_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.Set_date_countdown();
        }

        //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))
        {
            game_uGUI.current_game_uGUI.Defeat();
        }
    }