void RecieveInput() { var deadZone = 0.1f; if (Input.GetAxis("Vertical") > deadZone) { var status = m_CurrentMenuStatus; status--; if (status < PauseMenuSelection.ReturnToGame) { status = PauseMenuSelection.ReturnToGame; } m_DesiredStatus = status; } else if (Input.GetAxis("Vertical") < -deadZone) { var status = m_CurrentMenuStatus; status++; if (status > PauseMenuSelection.BackToMainMenu) { status = PauseMenuSelection.BackToMainMenu; } m_DesiredStatus = status; } if (Input.GetButtonDown("Confirm")) { switch (m_DesiredStatus) { case PauseMenuSelection.ReturnToGame: this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame; break; case PauseMenuSelection.Restart: m_DesiredStageName = Application.loadedLevelName; this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther; break; case PauseMenuSelection.BackToMainMenu: m_DesiredStageName = "MainMenu_Level"; this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther; break; default: return; } } else if (Input.GetButtonDown("Back") || Input.GetButtonDown("Start") || Input.GetKeyDown(KeyCode.Escape)) { this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame; } }
void Start() { m_PauseMenuStatus = PauseMenuStatus.Selecting; m_MenuSelector = GameObject.Find("Menu") as GameObject; if (GameObject.Find("Resume").GetComponent<M_MenuSelection>() != null) m_ReturnToGame = GameObject.Find("Resume").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_ReturnToGame = GameObject.Find("Resume").AddComponent<M_MenuSelection>() as M_MenuSelection; if (GameObject.Find("Restart").GetComponent<M_MenuSelection>() != null) m_Restart = GameObject.Find("Restart").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_Restart = GameObject.Find("Restart").AddComponent<M_MenuSelection>() as M_MenuSelection; if (GameObject.Find("ExitGame").GetComponent<M_MenuSelection>() != null) m_BackToMainMenu = GameObject.Find("ExitGame").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_BackToMainMenu = GameObject.Find("ExitGame").AddComponent<M_MenuSelection>() as M_MenuSelection; if (GameObject.Find("SelectLineL").GetComponent<M_MenuSelection>() != null) m_SelectLineLeft = GameObject.Find("SelectLineL").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_SelectLineLeft = GameObject.Find("SelectLineL").AddComponent<M_MenuSelection>() as M_MenuSelection; if (GameObject.Find("SelectLineR").GetComponent<M_MenuSelection>() != null) m_SelectLineRight = GameObject.Find("SelectLineR").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_SelectLineRight = GameObject.Find("SelectLineR").AddComponent<M_MenuSelection>() as M_MenuSelection; if (GameObject.Find("SelectPaint").GetComponent<M_MenuSelection>() != null) m_SelectPaint = GameObject.Find("SelectPaint").GetComponent<M_MenuSelection>() as M_MenuSelection; else m_SelectPaint = GameObject.Find("SelectPaint").AddComponent<M_MenuSelection>() as M_MenuSelection; m_DesiredStatus = PauseMenuSelection.ReturnToGame; m_CurrentMenuStatus = PauseMenuSelection.ReturnToGame; m_FadePlane = GameObject.Find("FadePlane").GetComponent<Renderer>().material; m_DesiredStageName = Application.loadedLevelName; }
void Start() { m_PauseMenuStatus = PauseMenuStatus.Selecting; m_MenuSelector = GameObject.Find("Menu") as GameObject; if (GameObject.Find("Resume").GetComponent <M_MenuSelection>() != null) { m_ReturnToGame = GameObject.Find("Resume").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_ReturnToGame = GameObject.Find("Resume").AddComponent <M_MenuSelection>() as M_MenuSelection; } if (GameObject.Find("Restart").GetComponent <M_MenuSelection>() != null) { m_Restart = GameObject.Find("Restart").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_Restart = GameObject.Find("Restart").AddComponent <M_MenuSelection>() as M_MenuSelection; } if (GameObject.Find("ExitGame").GetComponent <M_MenuSelection>() != null) { m_BackToMainMenu = GameObject.Find("ExitGame").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_BackToMainMenu = GameObject.Find("ExitGame").AddComponent <M_MenuSelection>() as M_MenuSelection; } if (GameObject.Find("SelectLineL").GetComponent <M_MenuSelection>() != null) { m_SelectLineLeft = GameObject.Find("SelectLineL").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_SelectLineLeft = GameObject.Find("SelectLineL").AddComponent <M_MenuSelection>() as M_MenuSelection; } if (GameObject.Find("SelectLineR").GetComponent <M_MenuSelection>() != null) { m_SelectLineRight = GameObject.Find("SelectLineR").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_SelectLineRight = GameObject.Find("SelectLineR").AddComponent <M_MenuSelection>() as M_MenuSelection; } if (GameObject.Find("SelectPaint").GetComponent <M_MenuSelection>() != null) { m_SelectPaint = GameObject.Find("SelectPaint").GetComponent <M_MenuSelection>() as M_MenuSelection; } else { m_SelectPaint = GameObject.Find("SelectPaint").AddComponent <M_MenuSelection>() as M_MenuSelection; } m_DesiredStatus = PauseMenuSelection.ReturnToGame; m_CurrentMenuStatus = PauseMenuSelection.ReturnToGame; m_FadePlane = GameObject.Find("FadePlane").GetComponent <Renderer>().material; m_DesiredStageName = Application.loadedLevelName; }