void getInputs() { //If we are on the title: if (Game_State_Scr.state == "title_Menu") { //If any Key is pressed on the title, goto main menu if (Input.anyKey) { Game_State_Scr.state = "main_Menu"; //GetComponent<TitleScreenSoundScript>().EnterMenu(); StartCoroutine("SceneDelay", 1.0f); } //If we are on any of the other menus: } else { //MOVEMENT ALONG MENUS: //wraps vertically/horizontally, and skips over any 'blank' spaces //Not moving at all if ((Input.GetAxis("Horizontal") > -0.8f && Input.GetAxis("Horizontal") < 0.8 && Input.GetAxis("Vertical") > -0.8f && Input.GetAxis("Vertical") < 0.8f) && (Input.GetAxis("Horizontal_Dpad") > -0.8f && Input.GetAxis("Horizontal_Dpad") < 0.8 && Input.GetAxis("Vertical_Dpad") > -0.8f && Input.GetAxis("Vertical_Dpad") < 0.8f)) { isStopped = true; //Going 'up' a menu (when 'back' button is pushed) if (Input.GetAxis("Cancel") > 0.0) { Game_State_Scr.state = previous; //GetComponent<MenuSoundScript>().ExitMenu(); StartCoroutine("SceneDelay", 1.0f); } //If the 'next' button is pushed: if (Input.GetAxis("Submit") > 0.0) { Menu_Obj_Scr selected_Obj = the_Grid [curr_x, curr_y].GetComponent <Menu_Obj_Scr> (); Game_State_Scr.state = selected_Obj.goto_Val; //GetComponent<MenuSoundScript>().EnterMenu(); StartCoroutine("SceneDelay", 1.0f); } return; } //Moving Up if ((Input.GetAxisRaw("Vertical") > 0.0f) || (Input.GetAxisRaw("Vertical_Dpad") > 0.0f)) { the_Grid [curr_x, curr_y].SetActive(false); do { if (curr_y != 0) { --curr_y; } else { curr_y = max_Y - 1; } } while (the_Grid [curr_x, curr_y] == null); //GetComponent<MenuSoundScript>().NavigateMenu(); the_Grid [curr_x, curr_y].SetActive(true); isStopped = false; } //Moving down if ((Input.GetAxis("Vertical") < 0.0f) || (Input.GetAxis("Vertical_Dpad") < 0.0f)) { the_Grid [curr_x, curr_y].SetActive(false); do { if (curr_y != max_Y - 1) { ++curr_y; } else { curr_y = 0; } } while (the_Grid [curr_x, curr_y] == null); //GetComponent<MenuSoundScript>().NavigateMenu(); the_Grid [curr_x, curr_y].SetActive(true); isStopped = false; } //Moving right if ((Input.GetAxis("Horizontal") > 0.0f) || (Input.GetAxis("Horizontal_Dpad") > 0.0f)) { the_Grid [curr_x, curr_y].SetActive(false); do { if (curr_x != max_X - 1) { ++curr_x; } else { curr_x = 0; } } while (the_Grid [curr_x, curr_y] == null); //GetComponent<MenuSoundScript>().NavigateMenu(); the_Grid [curr_x, curr_y].SetActive(true); isStopped = false; } //Moving left if ((Input.GetAxis("Horizontal") < 0.0f) || (Input.GetAxis("Horizontal_Dpad") < 0.0f)) { the_Grid [curr_x, curr_y].SetActive(false); do { if (curr_x != 0) { --curr_x; } else { curr_x = max_X - 1; } } while (the_Grid [curr_x, curr_y] == null); //GetComponent<MenuSoundScript>().NavigateMenu(); the_Grid [curr_x, curr_y].SetActive(true); isStopped = false; } //Going 'up' a menu (when 'back' button is pushed) if (Input.GetAxis("Cancel") > 0.0) { Game_State_Scr.state = previous; Game_State_Scr.goto_Scene(); } //If the 'next' button is pushed: if (Input.GetAxis("Submit") > 0.0) { Menu_Obj_Scr selected_Obj = the_Grid [curr_x, curr_y].GetComponent <Menu_Obj_Scr> (); Game_State_Scr.state = selected_Obj.goto_Val; Game_State_Scr.goto_Scene(); } } }
IEnumerator SceneDelay(float waitTime) { yield return(new WaitForSeconds(waitTime)); Game_State_Scr.goto_Scene(); }