Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class LevelManager : MonoBehaviour {
  7.  
  8.     private static LevelManager instance = null;
  9.     private PauseMenu pauseMenu;
  10.  
  11.     // Use this for initialization
  12.     void Awake () {
  13.  
  14.         pauseMenu = FindObjectOfType<PauseMenu>();
  15.  
  16.         if (instance == null)
  17.         {
  18.             instance = this;
  19.         }else if(instance != null)
  20.         {
  21.             Destroy(gameObject);
  22.         }
  23.  
  24.         DontDestroyOnLoad(gameObject);
  25.     }
  26.    
  27.     // Update is called once per frame
  28.     void Update () {
  29.     }
  30.  
  31.     public void LoadLevel(string name)
  32.     {
  33.         pauseMenu.SetPaused(false);
  34.         SceneManager.LoadScene(name);
  35.     }
  36.  
  37.     public void LoadLevel(int name)
  38.     {
  39.         pauseMenu.SetPaused(false);
  40.         SceneManager.LoadScene(name);
  41.     }
  42.  
  43.  
  44.     //Tf do you think it does?
  45.     public void RestartLevel()
  46.     {
  47.         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
  48.     }
  49.  
  50.     //Quits the application.. duh
  51.     public void Quit()
  52.     {
  53.         Debug.Log("Quit!");
  54.         Application.Quit();
  55.     }
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement