private void InitManagers() { Log = new LogManager { Enabled = true, SaveLog = true, RootFolder = WgibeatRootFolder, LogLevel = LogLevel.INFO }; Log.AddMessage("Initializing Cookies...", LogLevel.INFO); Cookies = new Dictionary <string, object>(); TextureManager.Log = Log; TextureManager.GraphicsDevice = this.GraphicsDevice; Metrics = new MetricsManager { Log = this.Log }; Settings = SettingsManager.LoadFromFile(WgibeatRootFolder + "\\settings.txt", this.Log); Log.LogLevel = (LogLevel)Settings.Get <int>("LogLevel"); HighScores = HighScoreManager.LoadFromFile(WgibeatRootFolder + "\\Scores.conf", this.Log); Profiles = ProfileManager.LoadFromFolder(WgibeatRootFolder + "\\Profiles", this.Log); //TODO: Refactor Text = TextManager.LoadFromFile(WgibeatRootFolder + "\\Content\\Text\\OptionText.txt", this.Log); Text.AddResource(WgibeatRootFolder + "\\Content\\Text\\EditorText.txt"); Text.AddResource(WgibeatRootFolder + "\\Content\\Text\\ModeText.txt"); Audio = new AudioManager(this.Log) { FallbackSound = (WgibeatRootFolder + "\\Content\\SoundEffects\\Fallback.ogg") }; Audio.SetMasterVolume((float)Settings.Get <double>("SongVolume")); Songs = new SongManager(this.Log, this.Audio, this.Settings); Sounds = new SoundEffectManager(this.Log, this.Audio, this.Settings); Crossfader = new CrossfaderManager(this.Log, this.Audio); CPUManager = new CPUManager(this.Log); CPUManager.LoadWeights("CPUSkill.txt"); _menuMusicManager = new MenuMusicManager(this.Log) { MusicFilePath = WgibeatRootFolder + "\\MenuMusic\\", AudioManager = this.Audio, Crossfader = this.Crossfader }; _menuMusicManager.LoadMusicList(_menuMusicManager.MusicFilePath + "MusicList.txt"); // _menuMusicManager.ChangeMusic("InitialLoad"); KeyMappings = new KeyMappings(this.Log); if (!KeyMappings.LoadFromFile("Keys.conf")) { KeyMappings.LoadDefault(); } UpdateManager = new UpdateManager { Log = this.Log }; }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this.gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } instance.PlayMusic(); DontDestroyOnLoad(gameObject); }
// Use this for initialization private void Awake() { if (!instance) { audioSource = this.GetComponent <AudioSource>(); instance = this; audioSource.Play(); audioSource.volume = 1f * PlayerPrefs.GetInt("SOUND_KEY"); } else if (instance != this) { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
void Awake() { if (_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != _instance) { Destroy(this.gameObject); } } }
void Start() { musicManager = GetComponent <MenuMusicManager>(); }