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");
         }
     }
 }
示例#2
0
 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;
         }
     }
 }