Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     //only work if press any key and the game in playing mode
     if (Input.anyKeyDown && GameManager.CurrentState == GameManager.GameState.Playing)
     {
         if (currentID == choosenID)                         //if player pick the right color
         {
             allowCheck = false;                             //stop checking color in FixedUpdate temporary
             GameManager.CountDown--;                        //count down number by 1
             if (GameManager.CountDown == 0)
             {
                 GameManager.instance.GameSuccess();                   //if the counter equal zero then Success
                 anim.SetTrigger("Wrong");                             //hide the picker
                 MainMenu.instance.CorrectPick(colorList [choosenID]); //call function in MAin menu, aim to countdownnumber text
                 return;
             }
             anim.SetTrigger("Correct");                     //animation effect for picker
             ChooseRandomID();                               //choose another color to choose
             spin.ChangeDirection();                         //send action to change the direction of the spin
             SoundManager.PlaySfx(soundCorrect);             //play correct sound
         }
         else
         {
             anim.SetTrigger("Wrong");                               //animation effet wrong
             GameManager.instance.GameOver();                        //call Game Over
             SoundManager.PlaySfx(soundFail);                        //play fail sound
         }
     }
 }