/// <summary> /// Used as second step on singleton initialisation. Used to specific code of the different Engine & Game managers /// The GameMgr stops all the BSEngine Managers and the different app states /// </summary> private void close() { SceneMgr.Release(); PoolMgr.Release(); InputMgr.Release(); m_stateStack.Clear(); foreach (string s in m_initializedStates.Keys) { m_initializedStates[s].Release(); } m_initializedStates.Clear(); StorageMgr.Release(); m_loader = null; }
/// <summary> /// Used as second step on singleton initialisation. Used to specific code of the different Engine & Game managers /// /// The GameMgr starts all the BSEngine managers and the different app states /// </summary> /// <returns>Should return true if everything went ok</returns> private bool open(BSEngineLoader loader) { m_stateStack = new Stack<State>(); m_initializedStates = new Dictionary<string, State>(); m_nextState = null; m_changeNextState = false; m_loader = loader; StorageMgr.Init(); m_initializedStates = loader.States; foreach (string s in m_initializedStates.Keys) { m_initializedStates[s].Init(); } InputMgr.Init(); PoolMgr.Init(); SceneMgr.Init(); return true; }
/// <summary> /// Used to initialize the GameMgr singleton instance /// </summary> ///<returns>True if everything went ok</returns> public static bool Init(BSEngineLoader loader) { if (m_instance != null) { Debug.LogError("Second initialisation not allowed"); return false; } else { m_instance = new GameMgr(); return m_instance.open(loader); } }