void Update() { if (on_board == true) { if (Input.GetKeyUp(KeyCode.F)) { //important values are saved in static class ManagerKeeper to re-use later. ManagerKeeper.Set_values(player.gameObject.GetComponent <Transform>().position, player.gameObject.GetComponent <CharController>().Return_number_of_lifes(), player.gameObject.GetComponent <CharController>().Return_number_of_cells(), player.gameObject.GetComponent <CharController>().Return_number_of_respawn_point()); ManagerKeeper.Set_manager_script_info(manager.gameObject.GetComponent <ManagerScript>().Set_current_time()); ManagerKeeper.Is_in_other_scene(true); fader.SetActive(true); //timer += Time.deltaTime; } if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { SceneManager.LoadScene("Pac_Punk"); } } }
void Update() { if (to_new_level == true) { if (reached_level == false) { ManagerKeeper.Increase_number_of_level(); // Debug.Log("number of level reached is " + ManagerKeeper.Get_number_of_reached_level()); reached_level = true; } if (reached_level == true) { level_complete_text.SetActive(true); if (level_complete_text.gameObject.GetComponent <LevelCompleteTextController>().Return_if_centered() == true) { start_timer = true; } if (start_timer == true) { timer += Time.deltaTime; if (timer > 5f) { // Debug.Log("timer is over 5"); level_complete_text.gameObject.GetComponent <Animator>().Play("LevelCompleteTextOut"); if (level_complete_text.gameObject.GetComponent <LevelCompleteTextController>().Return_if_out() == true && ManagerKeeper.Get_number_of_reached_level() == 2) { fader.SetActive(true); if (fader == true) { if (timer >= 9.5f) { SceneManager.LoadScene("Level_03_Lab");//poner aca la escena de transicion con el mensaje de complete level } } } } } } } }
void FixedUpdate() { //poner el fader antes de cambiar a otro escenario modificar el objecto publico player por fader if (player_here == true) { if (Input.GetKeyUp(KeyCode.F)) { interacting_sound.Play(); fader.SetActive(true); player.gameObject.GetComponent <CharController>().Set_if_is_interacting(true); ManagerKeeper.Is_ed102_entering_some_place(true); } if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { player.gameObject.GetComponent <Transform>().position = respawnPoint.gameObject.GetComponent <Transform>().position; player_here = false; ManagerKeeper.Is_ed102_entering_some_place(false); fader.gameObject.GetComponent <FaderScript>().Set_the_fade_out(); fader.gameObject.GetComponent <FaderScript>().Set_animation_complete(false); } } }
void Update() { if (to_new_level == true) { if (reached_level == false) { ManagerKeeper.Increase_number_of_level(); reached_level = true; } for (int i = 0; i < 1; i++) { fader.SetActive(true); } if (fader == true) { timer += Time.deltaTime; if (timer >= 1f) { SceneManager.LoadScene("TransitionScene");//poner aca la escena de transicion con el mensaje de complete level } } } }
void Update() { if (ManagerKeeper.Get_number_of_tries_availables() > 0) { time_counter_script_inside -= Time.deltaTime; if (start_music == false) { timer_for_music_start += Time.deltaTime; if (timer_for_music_start > 2f) { if (song_number == 0) { music[0].enabled = true; music[0].Play(); music[1].enabled = false; } if (song_number == 1) { music[1].enabled = true; music[1].Play(); music[0].enabled = false; } start_music = true; } } if (start_music == true) { if (music[song_number].volume < .1f) { music[song_number].volume += .02f * Time.deltaTime; } else { music[song_number].volume = 0.1f; } } if (music[song_number].isPlaying == false && paused == false) { song_number += 1; if (song_number == 2) { song_number = 0; } start_music = false; } if (time_counter_script_inside > 0) { if (Input.GetKeyUp(KeyCode.P)) { option = 0; paused = !paused; } if (paused == true) { Time.timeScale = 0; if (start_music == true) { if (song_number == 0) { music[0].Pause(); } if (song_number == 1) { music[1].Pause(); } } player.gameObject.GetComponent <CharController>().Set_if_player_can_move(false); foreach (GameObject child in enemy) { if (child != null) { child.gameObject.SetActive(false); } } for (int i = 0; i < objects_to_hide_when_paused.Length; i++) { objects_to_hide_when_paused[i].SetActive(false); } blacknened_background.gameObject.GetComponent <MeshRenderer>().enabled = false; gray_quad_for_pause.gameObject.GetComponent <MeshRenderer>().enabled = true; lights.SetActive(false); pause_text.gameObject.GetComponent <Text>().enabled = true; continue_text.gameObject.GetComponent <Text>().enabled = true; return_text.gameObject.GetComponent <Text>().enabled = true; if (option == 0) { continue_text.gameObject.GetComponent <Text>().color = select_color; if (Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.DownArrow)) { option = 1; continue_text.gameObject.GetComponent <Text>().color = unselect_color; interface_sounds[0].Play(); } if (Input.GetKeyUp(KeyCode.Return)) { interface_sounds[1].Play(); paused = false; } } if (option == 1) { return_text.gameObject.GetComponent <Text>().color = select_color; if (Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.UpArrow) && to_main_menu == false) { option = 0; return_text.gameObject.GetComponent <Text>().color = unselect_color; interface_sounds[0].Play(); } if (Input.GetKeyUp(KeyCode.Return)) { interface_sounds[1].Play(); to_main_menu = true; paused = false; } } } if (paused == false) { Time.timeScale = 1; if (start_music == true) { if (song_number == 0) { music[0].UnPause(); } if (song_number == 1) { music[1].UnPause(); } } minutes = Mathf.FloorToInt(time_counter_script_inside / 60F); seconds = Mathf.FloorToInt(time_counter_script_inside - minutes * 60); string niceTime = string.Format("{0:0}:{1:00}", minutes, seconds); text_on_screen.text = niceTime; player.gameObject.GetComponent <CharController>().Set_if_player_can_move(true); foreach (GameObject child in enemy) { if (child != null) { child.gameObject.SetActive(true); } } for (int i = 0; i < objects_to_hide_when_paused.Length; i++) { objects_to_hide_when_paused[i].SetActive(true); } battery_icon.gameObject.GetComponent <MeshRenderer>().enabled = true; blacknened_background.gameObject.GetComponent <MeshRenderer>().enabled = true; lights.SetActive(true); gray_quad_for_pause.gameObject.GetComponent <MeshRenderer>().enabled = false; pause_text.gameObject.GetComponent <Text>().enabled = false; continue_text.gameObject.GetComponent <Text>().enabled = false; return_text.gameObject.GetComponent <Text>().enabled = false; if (changed == false) { if (minutes == 8 && seconds == 0) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); changed = true; } if (minutes == 4 && seconds == 0) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); changed = true; } } if (changed == true) { if (minutes == 6 && seconds == 0) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); changed = false; } if (minutes == 2 && seconds == 0) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); changed = false; } } if (player.gameObject.GetComponent <CharController>().Return_number_of_cells() == 0 && run_out_of_cells == false) { if (player.gameObject.GetComponent <CharController>().Get_if_dead_by_enemy() == false) { player.gameObject.GetComponent <CharController>().Set_if_is_dead_zone_or_dead(false); foreach (GameObject child in enemy) { if (child != null) { child.gameObject.GetComponent <EnemyController>().Reset_number_of_hits(); } } run_out_of_cells = true; } } if (player.gameObject.GetComponent <CharController>().Get_if_go_to_retry() == true && go_to_retry == false) { ManagerKeeper.Decrease_number_of_tries(); player.gameObject.GetComponent <CharController>().Set_if_go_to_retry(false); go_to_retry = true; } if (go_to_retry == true) { timer_to_restart_level += Time.deltaTime; if (start_music == true) { music[song_number].volume -= .05f * Time.deltaTime; if (music[song_number].volume < 0) { music[song_number].Stop(); } } if (timer_to_restart_level > 3f) { for (int i = 0; i < 1; i++) { fader.SetActive(true); } if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { { SceneManager.LoadScene("Game_Over_Scene"); } } } } if (to_main_menu == true) { music[song_number].Stop(); gray_quad_for_pause.gameObject.GetComponent <MeshRenderer>().enabled = true; foreach (GameObject child in enemy) { if (child != null) { child.gameObject.SetActive(false); } } fader.SetActive(true); if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { SceneManager.LoadScene("MainMenu"); } } } } else if (time_counter_script_inside <= 0) { if (out_of_time == false) { player.gameObject.GetComponent <CharController>().Set_if_is_dead_zone_or_dead(false); out_of_time = true; } if (out_of_time == true && player.gameObject.GetComponent <CharController>().Return_number_of_lifes() > 0) { delay_for_reset_game += Time.deltaTime; if (delay_for_reset_game > 3) { time_counter_script_inside = time_counter; time_counter -= Time.deltaTime; delay_for_reset_game = 0; out_of_time = false; } } if (out_of_time == true && player.gameObject.GetComponent <CharController>().Return_number_of_lifes() == 0) { time_counter_script_inside = 0; ManagerKeeper.Decrease_number_of_tries(); } } } else { timer_to_restart_level += Time.deltaTime; if (start_music == true) { music[song_number].volume -= .05f * Time.deltaTime; if (music[song_number].volume < 0) { music[song_number].Stop(); } } if (timer_to_restart_level > 3f) { for (int i = 0; i < 1; i++) { fader.SetActive(true); } if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { { SceneManager.LoadScene("Game_Over_Scene_Final"); } } } } }
private void Set_current_level() { if (number_of_level == 0) { ManagerKeeper.Set_current_level(0); } if (number_of_level == 1) { ManagerKeeper.Set_current_level(1); } if (number_of_level == 2) { ManagerKeeper.Set_current_level(2); } if (number_of_level == 3) { ManagerKeeper.Set_current_level(3); } if (number_of_level == 4) { ManagerKeeper.Set_current_level(4); } if (number_of_level == 5) { ManagerKeeper.Set_current_level(5); } //condition for the returning from other scenes when lose if (ManagerKeeper.Get_if_other_scene() == true && ManagerKeeper.Get_if_mini_game_completed() == false) { time_counter_script_inside = ManagerKeeper.Get_old_time_script_inside(); special_computer_mini_game.gameObject.GetComponent <BoxCollider>().enabled = false; player.gameObject.GetComponent <Transform>().position = ManagerKeeper.Get_old_players_position(); player.gameObject.GetComponent <CharController>().Set_lifes(ManagerKeeper.Get_old_number_of_lifes()); player.gameObject.GetComponent <CharController>().Keep_respawn_point(ManagerKeeper.Get_old_respawn_point()); } if (ManagerKeeper.Get_if_other_scene() == true && ManagerKeeper.Get_if_mini_game_completed() == true)//when winning { Debug.Log(ManagerKeeper.Get_respawn_point()); time_counter_script_inside = ManagerKeeper.Get_old_time_script_inside(); special_computer_mini_game.gameObject.GetComponent <BoxCollider>().enabled = false; player.gameObject.GetComponent <CharController>().Keep_respawn_point(ManagerKeeper.Get_old_respawn_point()); ManagerKeeper.Set_if_mini_game_was_completed(false); ManagerKeeper.Is_in_other_scene(false); came_from_mini_game = true; } //else else if (ManagerKeeper.Get_if_other_scene() == false && ManagerKeeper.Get_if_mini_game_completed() == false) { time_counter_script_inside = time_counter; } if (came_from_mini_game == true) { if (ManagerKeeper.Get_respawn_point() == 0) { player.gameObject.GetComponent <Transform>().position = respawn_point[0].gameObject.GetComponent <Transform>().position; } if (ManagerKeeper.Get_respawn_point() == 1) { player.gameObject.GetComponent <Transform>().position = respawn_point[1].gameObject.GetComponent <Transform>().position; } if (ManagerKeeper.Get_respawn_point() == 2) { player.gameObject.GetComponent <Transform>().position = respawn_point[2].gameObject.GetComponent <Transform>().position; } if (ManagerKeeper.Get_respawn_point() == 3) { player.gameObject.GetComponent <Transform>().position = respawn_point[3].gameObject.GetComponent <Transform>().position; } } }
void FixedUpdate() { if (enable_on_screen == true) { if (enemy_alive == true) { float distance = Vector3.Distance(transform.position, target.position); if (can_attack == true) { if (distance < max_distance && this_object.position.x < player.gameObject.GetComponent <Transform>().position.x) { if (distance > min_distance) { play_attack_anim = false; play_idle_anim = false; play_running_anim = true; Vector3 dirToTarget = transform.position - player.transform.position; Vector3 newPos = transform.position - dirToTarget; rotation_sprite = new Vector3(1, 1, 1); transform.localScale = Vector3.SmoothDamp(transform.localScale, rotation_sprite, ref velocity, smoothTime, 10); rb.MovePosition(Vector3.Lerp(transform.position, newPos, speed_when_spots_player * Time.fixedDeltaTime)); Light_slider(false); } if (distance < min_distance && player.gameObject.GetComponent <CharController>().Player_is_alive() == true) { play_attack_anim = true; play_idle_anim = false; play_running_anim = false; Light_slider(true); Increase_number_of_hits(); } else if (distance < min_distance && player.gameObject.GetComponent <CharController>().Player_is_alive() == false) { play_attack_anim = false; play_idle_anim = true; play_running_anim = false; Light_slider(false); } } else if (distance < max_distance && this_object.position.x > player.gameObject.GetComponent <Transform>().position.x) { if (distance > min_distance) { play_attack_anim = false; play_idle_anim = false; play_running_anim = true; Vector3 dirToTarget = transform.position - player.transform.position; Vector3 newPos = transform.position - dirToTarget; rotation_sprite = new Vector3(-1, 1, 1); transform.localScale = Vector3.SmoothDamp(transform.localScale, rotation_sprite, ref velocity, smoothTime, 10); rb.MovePosition(Vector3.Lerp(transform.position, newPos, speed_when_spots_player * Time.fixedDeltaTime)); Light_slider(false); } if (distance < min_distance && player.gameObject.GetComponent <CharController>().Player_is_alive() == true) { play_attack_anim = true; play_idle_anim = false; play_running_anim = false; Light_slider(true); Increase_number_of_hits(); } else if (distance < min_distance && player.gameObject.GetComponent <CharController>().Player_is_alive() == false) { play_attack_anim = false; play_idle_anim = true; play_running_anim = false; Light_slider(false); } } else { delay_to_random_patrol += Time.fixedDeltaTime; if (delay_to_random_patrol >= 3) { Generate_random_number(); } if (random_to_patrol == 1) { if (quad.gameObject.GetComponent <Animator>().enabled == true)//newly added condition { play_attack_anim = false; play_idle_anim = false; play_running_anim = true; } if (direction == true) { rb.MovePosition(transform.position + translation * speed * Time.fixedDeltaTime); rotation_sprite = new Vector3(1, 1, 1); transform.localScale = Vector3.SmoothDamp(transform.localScale, rotation_sprite, ref velocity, smoothTime, 10); } else { rb.MovePosition(transform.position + translation_to_left * speed * Time.fixedDeltaTime); rotation_sprite = new Vector3(-1, 1, 1); transform.localScale = Vector3.SmoothDamp(transform.localScale, rotation_sprite, ref velocity, smoothTime, 10); } } else { if (quad.gameObject.GetComponent <Animator>().enabled == true)//added condition { play_attack_anim = false; play_idle_anim = true; play_running_anim = false; } } } if (enemy_difficulty == 0) { if (numbers_of_hitted == 100 || numbers_of_hitted == 200 || numbers_of_hitted == 300 || numbers_of_hitted == 400 || numbers_of_hitted == 500) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); if (player.gameObject.GetComponent <CharController>().Return_number_of_cells() == 0) { Set_new_status(); Set_if_can_attack(false); } else { Set_if_can_attack(true); } } } if (enemy_difficulty == 1) { if (numbers_of_hitted == 5 || numbers_of_hitted == 10 || numbers_of_hitted == 15 || numbers_of_hitted == 20 || numbers_of_hitted == 25) { player.gameObject.GetComponent <CharController>().Decrease_number_of_cells(); if (player.gameObject.GetComponent <CharController>().Return_number_of_cells() == 0) { Set_new_status(); Set_if_can_attack(false); } else { Set_if_can_attack(true); } } } } if (ManagerKeeper.Get_if_other_scene() == true)//to avoid enemy hit played when entering the minigame level03 { can_attack = false; } if (ManagerKeeper.Get_if_mini_game_completed() == true || ManagerKeeper.Get_if_mini_game_completed() == false)//to avoid enemy hit played when entering the minigame level03 { can_attack = true; } if (ManagerKeeper.Return_if_is_ed102_enteroing_some_place() == true)//to avoid enemies hit the player when entering some place { can_attack = false; } if (ManagerKeeper.Return_if_is_ed102_enteroing_some_place() == false) { can_attack = true; } } if (enemy_alive == false) { delay_for_dead += Time.fixedDeltaTime; play_attack_anim = false; play_idle_anim = false; play_running_anim = false; play_die_anim = true; if (delay_for_dead >= 1.5f) { Destroy(gameObject); delay_for_dead = 0; } } } }
void Update() { if (is_game_over_scene == false)////code for transition scene { music.volume += 0.025f * Time.deltaTime; if (music.volume > 0.1f) { music.volume = 0.1f; } if (screen_text[1].gameObject.GetComponent <TextEventsController>().Return_if_start_timer() == true) { timer += Time.deltaTime; if (timer >= 1f) { if (Input.GetKeyUp(KeyCode.Return)) { volume_down = true; interface_sound[0].Play(); key_was_pressed = true; screen_text[0].gameObject.GetComponent <Animator>().Play("TextControllerOut"); screen_text[1].gameObject.GetComponent <Animator>().Play("PressTextOut"); } } } } if (is_game_over_scene_final == true)////code for game over final { if (screen_text[1].gameObject.GetComponent <TextEventsController>().Return_if_start_timer() == true) { timer += Time.deltaTime; if (timer >= 1f) { if (Input.GetKeyUp(KeyCode.Escape)) { volume_down = true; interface_sound[1].Play(); screen_text[0].gameObject.GetComponent <Animator>().Play("GameOverFadeOut"); screen_text[1].gameObject.GetComponent <Animator>().Play("ToMainMenuOutInBlue"); ManagerKeeper.Reset_number_of_tries_availables(); to_main_menu = true; } } } } else if (is_game_over_scene == true && is_game_over_scene_final == false)//code fot game over with retry { if (volume_down == false) { music.volume += 0.05f * Time.deltaTime; if (music.volume > 0.1f) { music.volume = 0.1f; } } //Debug.Log("tries are " + ManagerKeeper.Get_number_of_tries_availables()); //Debug.Log("number of reached level is " + ManagerKeeper.Get_number_of_reached_level()); if (screen_text[1].gameObject.GetComponent <TextEventsController>().Return_if_start_timer() == true) { timer += Time.deltaTime; if (timer >= 1f) { if (Input.GetKeyUp(KeyCode.Return)) { volume_down = true; interface_sound[0].Play(); to_main_menu = false; screen_text[0].gameObject.GetComponent <Animator>().Play("GameOverFadeOut"); screen_text[1].gameObject.GetComponent <Animator>().Play("PressTextOutInBlue"); screen_text[2].gameObject.GetComponent <Animator>().Play("ToMainMenuOut"); } if (Input.GetKeyUp(KeyCode.Escape)) { volume_down = true; interface_sound[1].Play(); to_main_menu = true; screen_text[0].gameObject.GetComponent <Animator>().Play("GameOverFadeOut"); screen_text[1].gameObject.GetComponent <Animator>().Play("PressTextFadeOut"); screen_text[2].gameObject.GetComponent <Animator>().Play("ToMainMenuOutInBlue"); ManagerKeeper.Reset_number_of_tries_availables(); ManagerKeeper.Reset_number_of_level(); } } } } if (volume_down == true) { music.volume -= 0.05f * Time.deltaTime; } if (screen_text[1].gameObject.GetComponent <TextEventsController>().Return_if_to_next_scene() == true && to_main_menu == false) { if (ManagerKeeper.Get_number_of_reached_level() == 0) { SceneManager.LoadScene("Level_01_Depo"); } if (ManagerKeeper.Get_number_of_reached_level() == 1) { SceneManager.LoadScene("Level_02_Factory"); } if (ManagerKeeper.Get_number_of_reached_level() == 2) { SceneManager.LoadScene("Level_03_Lab"); } if (ManagerKeeper.Get_number_of_reached_level() == 3) { SceneManager.LoadScene("Level_04_Stereo_City"); } if (ManagerKeeper.Get_number_of_reached_level() == 4) { SceneManager.LoadScene("Level_05_The_Outlands"); } if (ManagerKeeper.Get_number_of_reached_level() == 5) { SceneManager.LoadScene("Final_Scene"); } } if (screen_text[1].gameObject.GetComponent <TextEventsController>().Return_if_to_next_scene() == true && to_main_menu == true) { ManagerKeeper.Reset_number_of_tries_availables(); SceneManager.LoadScene("MainMenu"); } }
void Update() { if (game_started == false) { if (Input.GetKeyUp(KeyCode.Return)) { interaction_sound[0].Play(); fader.SetActive(true); } if (fader.gameObject.GetComponent <FaderScript>().Return_animation_complete() == true) { menu_screen.SetActive(false); fader.SetActive(true); fader.gameObject.GetComponent <FaderScript>().Set_the_fade_out(); game_started = true; } } if (game_started == true) { life_icon.SetActive(true); score_text.SetActive(true); timer_for_enemies_on_start_level += Time.deltaTime; if (timer_for_enemies_on_start_level >= 2f) { for (int i = 0; i < 4; i++) { enemy_ghost[i].SetActive(true); } timer_for_enemies_on_start_level = 0; } score_string = "Score: " + score.ToString(); screen_score.text = score_string; if (special_icon_collected == true) { timer += Time.deltaTime; if (timer >= critical_time) { } if (timer >= max_time) { Debug.Log("Special icon is out"); for (int i = 0; i < 4; i++) { if (enemy_ghost[i].gameObject.GetComponent <enemyGhostController>().Return_if_enemy_hit_the_player() == true) { enemy_ghost[i].gameObject.GetComponent <enemyGhostController>().Set_if_player_can_be_hitted(); } } special_icon_collected = false; timer = 0; } } if (icons_collected == numberOfTaggedObjects + numberOfSpecialTaggedObject) { player.gameObject.GetComponent <CharControllerForPacPunk>().Set_stop_music(); Keep_characters_static(); life_icon.SetActive(false); score_text.SetActive(false); game_completed_screen.SetActive(true); ManagerKeeper.Set_if_mini_game_was_completed(true); if (Input.GetKeyUp(KeyCode.Return)) { interaction_sound[0].Play(); random_respawn = Random.Range(0, 5); Debug.Log(random_respawn); start_timer = true; } if (start_timer == true) { ManagerKeeper.Set_respawn_point(random_respawn); SceneManager.LoadScene("Level_03_Lab"); } } if (icons_collected != numberOfTaggedObjects + numberOfSpecialTaggedObject) { if (Input.GetKeyUp(KeyCode.Escape)) { interaction_sound[1].Play(); Keep_characters_static(); start_timer = true; player.gameObject.GetComponent <CharControllerForPacPunk>().Set_stop_music(); } if (start_timer == true) { fader.SetActive(true); ManagerKeeper.Set_if_mini_game_was_completed(false); timer_to_back_to_level03 += Time.deltaTime; if (timer_to_back_to_level03 >= 3f && timer_to_back_to_level03 <= 5f) { // player.gameObject.GetComponent<CharControllerForPacPunk>().Set_stop_music(); fader.SetActive(false); life_icon.SetActive(false); score_text.SetActive(false); game_over_screen.SetActive(true); } if (timer_to_back_to_level03 > 5) { SceneManager.LoadScene("Level_03_Lab"); } } } if (player_was_hitted == true && player.gameObject.GetComponent <CharControllerForPacPunk>().Return_number_of_lifes() >= 1) { Freeze_characters_stuff(); timer_to_restart += Time.deltaTime; if (timer_to_restart > delay_to_pause && timer_to_restart < delay_to_restart) { Restart_characters_stuff(); player.gameObject.GetComponent <CharControllerForPacPunk>().Decrease_life(); timer_to_restart = 0; } player_was_hitted = false; } if (player.gameObject.GetComponent <CharControllerForPacPunk>().Return_number_of_lifes() == 0) { player.gameObject.GetComponent <CharControllerForPacPunk>().Set_stop_music(); Keep_characters_static(); fader.SetActive(true); timer_to_back_to_level03 += Time.deltaTime; if (timer_to_back_to_level03 >= 3f && timer_to_back_to_level03 <= 5f) { fader.SetActive(false); life_icon.SetActive(false); score_text.SetActive(false); game_over_screen.SetActive(true); } if (timer_to_back_to_level03 > 5) { SceneManager.LoadScene("Level_03_Lab"); } } } }