public void Delete_current_profile_selected() { Close_ask_confirmation(); my_game_master.Delete_this_profile(my_game_master.current_profile_selected); profiles_array[my_game_master.current_profile_selected].Set_off(); //search if it is left a profile int temp_profile_slot = -1; for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++) { if (my_game_master.this_profile_have_a_save_state_in_it[i] && temp_profile_slot == -1) { temp_profile_slot = i; break; } } if (temp_profile_slot >= 0) //if there is a profile { Select_this_profile(temp_profile_slot); } else //no save data { //so you MUST create a profile Create_new_profile(0, false); } }
public void Delete_this_profile(int profile = -1) { if (profile == -1) { for (int i = 0; i < 10; i++) { PlayerPrefs.SetInt("Level" + i + "_score", -1); PlayerPrefs.SetInt("Level" + i, 0); } profile = my_game_master.current_profile_selected; } Close_ask_confirmation(); my_game_master.Delete_this_profile(profile); profiles_array[profile].Set_off(); //search if it is left a profile int temp_profile_slot = -1; for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++) { if (my_game_master.this_profile_have_a_save_state_in_it[i] && temp_profile_slot == -1) { temp_profile_slot = i; break; } } if (temp_profile_slot >= 0) //if there is a profile { Select_this_profile(temp_profile_slot); } else //no save data { //so you MUST create a profile Create_new_profile(0, false); } }