private void Awake()
 {
     if (!Instance)
     {
         Instance = this;
         Instance.transform.SetParent(null);
         Instance.SetFramerate();
         DontDestroyOnLoad(Instance);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Beispiel #2
0
        void Awake()
        {
            //Set the target framerate.
            ApplicationManager.SetFramerate();

            //Find the UI Manager
            if (_uiManager = FindObjectOfType <UIManager>())
            {
#if UNITY_EDITOR
                Debug.Log("GameManager: UI Manager found!");
#endif
                //Update the state of the game.
                _uiManager.UpdateStoryText(_actualState ? _actualState.GetStoryText() : string.Empty);
            }
            //Find the Music Manager.
            if (_musicManager = FindObjectOfType <MusicManager>())
            {
#if UNITY_EDITOR
                Debug.Log("GameManager: Music Manager found!");
#endif
                //Set the music for Music Manager.
                _musicManager.SetMusicClip(_actualState.GetMusicClip());
            }
        }