private void Update() { //選択済みなら処理しない if (wasDecided) { return; } //入力状態受け取り float axis = Input.GetAxisRaw("Vertical"); float axis2 = Input.GetAxisRaw("Vertical2"); bool pressUp = (Input.GetKey(KeyCode.UpArrow) || axis > 0.0f || axis2 > 0.0f); bool pressDown = (Input.GetKey(KeyCode.DownArrow) || axis < 0.0f || axis2 < 0.0f); //連続入力制御 if (pressDelay > 0f) { pressDelay -= Time.deltaTime; } //カーソル移動 if (pressDelay <= 0f) { int input = (pressDown ? 1 : pressUp ? choices.Length - 1 : 0); int newChoice = (choice + input) % choices.Length; // カーソル移動があった場合に処理する if (newChoice != choice) { SoundPlayer.Play(cursorSE); choices[choice].GetComponent <Text>().color = new Color(1f, 1f, 1f); choice = newChoice; choices[choice].GetComponent <Text>().color = new Color(1f, 0.8f, 0f); pressDelay = 0.25f; } } //ステージ選択 bool pressSubmit = Input.GetButtonDown("Submit"); if (pressSubmit) { wasDecided = true; SoundPlayer.Play(decisionSE); switch (choice) { //プレイに戻る case 0: Init(); pauseManager.ChangePauseState(); break; //タイトルに戻る case 1: FadeManager.fadeColor = Color.black; FadeManager.FadeOut("TitleScene"); break; default: FadeManager.fadeColor = Color.black; Debug.Log("PauseMenu:SelectError"); break; } } }