//-------------------------------------------------------------------------------------- // Methods (General): //-------------------------------------------------------------------------------------- #region void Initialize() /// <summary> /// Initialize the manager. /// </summary> public void Initialize() { // Initialize this manager only once: if (initialized) { return; } // Create all the chapters data of the game: var chaptersDescriptor = LoadXmlFromResources <ChaptersXml>(CHAPTERS_PATH); if (chaptersDescriptor != null) { Chapters = ChapterData.Create(chaptersDescriptor); } else { throw new Exception("Can't load the chapters descriptor."); } // Load the font of the game: TextFont = Resources.Load <Font>(FONT_NAME); // Load the profiles & options of the game: LoadCurrentProfiles(); LoadOptions(); // Set the initial state of the game: State = new MenuState(); State.Initialize(); // Change the initialized flag: initialized = true; }
private bool unPause;//flag needed so object which handles input to start the pausemenu knows when to unpause public void ResetMenu() { index = 0; states = new MenuState[stateObjects.Length]; for (int i = 0; i < stateObjects.Length; i++) { MenuState theState = stateObjects[i].GetComponent <MenuState>(); states[i] = theState; //for now, dont worry about setting any states theState.Initialize(); theState.GetGameObject().SetActive(false);//just in case. } }