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()); } } }
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); } }
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(); } }