Example #1
0
        private void ensureComponents()
        {
            Debug.Log("Creating injector game object ...");

            if (_gameObject == null)
            {
                _gameObject      = new GameObject();
                _gameObject.name = "CSLMusicMod_GO";
            }

            if (_injector == null)
            {
                _injector = _gameObject.AddComponent <MusicInjector>();
            }

            // Create settings
            if (_settings == null)
            {
                _settings = _gameObject.AddComponent <SettingsManager>();
            }

            // Create the music list
            if (_music == null)
            {
                _music = _gameObject.AddComponent <MusicManager>();
            }

            // Create the converter
            if (_conversion == null)
            {
                _conversion = _gameObject.AddComponent <ConversionManager>();
            }

            //Create music player
            if (_musicplayer == null)
            {
                _musicplayer = _gameObject.AddComponent <BackgroundMusicPlayer>();
            }

            // Create folders
            _gameObject.GetComponent <MusicManager>().CreateMusicFolder();

            // Load the settings
            _gameObject.GetComponent <SettingsManager>().LoadModSettings();

            //Add audio watcher to player
            _musicplayer.AudioWatcher = _injector.AudioWatcher;
        }
Example #2
0
        public override void OnLevelUnloading()
        {
            if (_gameObject != null)
            {
                MonoBehaviour.Destroy(_gameObject);
            }
            if (_injector != null)
            {
                MonoBehaviour.Destroy(_injector);
            }
            if (_ui != null)
            {
                MonoBehaviour.Destroy(_ui);
            }

            _gameObject = null;
            _injector   = null;
            _ui         = null;

            base.OnLevelUnloading();
        }
Example #3
0
        public override void OnLevelUnloading()
        {
            if (_gameObject != null)
                MonoBehaviour.Destroy(_gameObject);
            if (_injector != null)
                MonoBehaviour.Destroy(_injector);
            if (_ui != null)
                MonoBehaviour.Destroy(_ui);

            _gameObject = null;
            _injector = null;
            _ui = null;

            base.OnLevelUnloading();
        }
Example #4
0
        private void ensureComponents()
        {
            Debug.Log("Creating injector game object ...");

            if (_gameObject == null)
            {
                _gameObject = new GameObject();
                _gameObject.name = "CSLMusicMod_GO";
            }

            if (_injector == null)
            {
                _injector = _gameObject.AddComponent<MusicInjector>();
            }

            // Create settings
            if (_settings == null)
            {
                _settings = _gameObject.AddComponent<SettingsManager>();
            }

            // Create the music list
            if (_music == null)
                _music = _gameObject.AddComponent<MusicManager>();

            // Create the converter
            if (_conversion == null)
                _conversion = _gameObject.AddComponent<ConversionManager>();

            //Create music player
            if (_musicplayer == null)
                _musicplayer = _gameObject.AddComponent<BackgroundMusicPlayer>();

            // Create folders
            _gameObject.GetComponent<MusicManager>().CreateMusicFolder();

            // Load the settings
            _gameObject.GetComponent<SettingsManager>().LoadModSettings();

            //Add audio watcher to player
            _musicplayer.AudioWatcher = _injector.AudioWatcher;
        }