示例#1
0
 void DownKeyCheck()
 {
     if (Input.anyKeyDown)
     {
         foreach (KeyCode code in Enum.GetValues(typeof(KeyCode)))
         {
             if (code == answerKey && Input.GetKeyDown(code))
             {
                 //答えがあったていた時の処理
                 //チュートリアルの場合は例外
                 if (GetGameState() == GameState.Tutorial)
                 {
                     Palette.RemoveColor(PantsColor.Red);
                     tutorialText.GetComponent <Text>().text = "正解!";
                     correctSE.Play();
                     neverDone1  = true;
                     answerCount = 0;
                     SetGameState(GameState.Main);
                     IsEnableInput = false;
                     neverDone     = true;
                 }
                 else if (GetGameState() == GameState.Main)
                 {
                     Palette.RemoveColor(PantsColor.Red);
                     IsEnableInput = false;
                     correctSE.Play();
                     answerCount++;
                     SetGameState(GameState.Result);
                     mainText.GetComponent <Text>().text = "正解!";
                 }
                 break;
             }
             else if (code != KeyCode.Space && Input.GetKeyDown(code))
             {
                 //間違っていた時の処理
                 Debug.Log("間違い");
                 wrongSE.Play();
                 answerCount++;
                 break;
             }
         }
     }
 }