/// <summary> /// NONE FOR NO MENU /// </summary> /// <param name="type"></param> public void switchMenu(MenuSwitcherType type) { setInsideGameStatus(type); if (type == MenuSwitcherType.MAIN_MENU) { if (insideGame) { type = MenuSwitcherType.INGAME_MAIN_MENU; } else { type = MenuSwitcherType.OUTGAME_MAIN_MENU; } } setActiveMenues(type); if (type == MenuSwitcherType.NONE || type == MenuSwitcherType.NEW_GAME) { m_activeMenu = null; Time.timeScale = 1; SceneController sceneCtrl = FindObjectOfType <SceneController>(); insideGame = true; if (type == MenuSwitcherType.NEW_GAME) { SaveData.current.clearSaveFile(); sceneCtrl.LoadStartingScene(); } } }
private void setInsideGameStatus(MenuSwitcherType type) { if (m_activeMenu == null) { if (type == MenuSwitcherType.INGAME_MAIN_MENU) { insideGame = true; } else if (type == MenuSwitcherType.OUTGAME_MAIN_MENU) { insideGame = false; } } }
private void setActiveMenues(MenuSwitcherType type) { foreach (Menu mnu in m_menuArray) { if (mnu.m_menuType == type) { mnu.gameObject.SetActive(true); m_activeMenu = mnu; } else { mnu.gameObject.SetActive(false); } } }