Exemple #1
0
        /// <summary>
        /// 	Inects necessary dependencies and initalizes the object.
        /// </summary>
        public void Initialize(SceneManager sceneManager, MusicManager musicManager)
        {
            if (_isInitialized)
                throw new InvalidOperationException ("Already initialized.");

            if (sceneManager == null)
                throw new ArgumentNullException("sceneManager");

            if (musicManager == null)
                throw new ArgumentNullException("musicManager");

            _isInitialized = true;
        }
Exemple #2
0
 void Start()
 {
     // If there is no instance of this class, set it.
     if (Instance == null) {
         DontDestroyOnLoad (gameObject); // Don't destroy this object
         Instance = this;
         if (splashObj != null) {
             canvasObj = (GameObject)Instantiate (splashObj);
             canvasObj.transform.SetParent (transform);
             canvasObj.transform.position = Vector3.zero;
             splashCanvasGroup = canvasObj.GetComponent<CanvasGroup> ();
             canvasObj.GetComponent<Canvas> ().sortingOrder = 999;
             DontDestroyOnLoad (splashObj);
         }
         DontDestroyOnLoad (blackOverlay);
         blackOverlay.GetComponent<Canvas> ().sortingOrder = 998;
         Instance.StartCoroutine (LoadNextLevelFadeIn ());
     } else {
         Debug.LogError ("There is already a SceneManager in the scene.");
         GameObject.Destroy (this);
     }
 }