示例#1
0
    /// <summary>
    /// Method assigned to the buttons
    /// </summary>
    /// <param name="btn">ref to the button object</param>
    void OnClick(Button btn)
    {
        if (quizManager.GameStatus == GameStatus.PLAYING)
        {
            //if answered is false
            if (!answered)
            {
                //set answered true
                answered = true;
                //get the bool value
                bool val = quizManager.Answer(btn.name);

                //if its true
                if (val)
                {
                    //set color to correct
                    //btn.image.color = correctCol;
                    StartCoroutine(BlinkImg(btn.image));
                }
                else
                {
                    //else set it to wrong color
                    btn.image.color = wrongCol;
                }
            }
        }
    }
示例#2
0
    void OnClick(Button btn)
    {
        if (!answered)
        {
            answered = true;

            bool val = quizManager.Answer(btn.name);


            if (val)
            {
                counter++;

                if (counter == 5)
                {
                    BonusPanel.gameObject.SetActive(true);

                    animator.SetBool("Show", true);
                    StartCoroutine(BonusPanelDis());
                    StartCoroutine(BonusPointLines());
                    counter = 0;
                }

                btn.image.color = correctCol;
            }
            else
            {
                btn.image.color = wrongCol;
                counter         = 0;
            }
        }
        StartRotation();
    }
 private void OnClick(Button btn)
 {
     if (!answered)
     {
         answered = true;
         bool val = quizManager.Answer(btn.name);
         if (val)
         {
             btn.image.color = correct;
         }
         else
         {
             btn.image.color = wrong;
         }
     }
 }
示例#4
0
  public void OnClick(Button btn)
  {
      if (quizManager.gameStatus == QuizManager.GameStatus.Playing)
      {
          if (!answered)
          {
              answered = true;
              bool val = quizManager.Answer(btn.name);
              if (val)
              {
                  btn.image.color = correctColor;
              }

              else
              {
                  btn.image.color = wrongColor;
              }
          }
      }

      switch (btn.name)
      {
      case "START QUIZ 1":
          quizManager.StartGame(0);
          mainMenuPanel.SetActive(false);
          gameMenuPanel.SetActive(true);
          break;

      case "START QUIZ 2":
          quizManager.StartGame(1);
          mainMenuPanel.SetActive(false);
          gameMenuPanel.SetActive(true);
          break;

      case "START QUIZ 3":
          quizManager.StartGame(2);
          mainMenuPanel.SetActive(false);
          gameMenuPanel.SetActive(true);
          break;

      case "Quit":
          break;
      }
  }
示例#5
0
 private void OnClick(Button btn)
 {
     if (!answered)
     {
         answered = true;
         bool val = quizManager.Answer(btn.name);
         if (val)
         {
             btn.image.color = correctColor;
             if (quizManager.questions.Count == 0)
             {
                 Invoke("QuizDone", 0.5f);
             }
         }
         else
         {
             btn.image.color = wrongColor;
             Invoke("QuizBeguin", 0.5f);
         }
     }
 }
示例#6
0
    /// <summary>
    /// Method assigned to the buttons
    /// </summary>
    /// <param name="btn">ref to the button object</param>
    void OnClick(Button btn)
    {
        //if answered is false
        if (!answered)
        {
            //set answered true
            answered = true;
            //get the bool value
            bool val = quizManager.Answer(btn.name);

            //if its true
            if (val)
            {
                //set color to correct
                btn.image.color = correctCol;
            }
            else
            {
                //else set it to wrong color
                btn.image.color = wrongCol;
            }
        }
    }
示例#7
0
    private void OnClick(Button btn) //Should Change the button colour on click
    {
        if (quizManager.GameStatus == GameStatus.Playing)
        {
            if (!answered)
            {
                answered = true;
                bool val = quizManager.Answer(btn.name);

                if (val)
                {
                    btn.image.color = correct;
                }
                else
                {
                    btn.image.color = wrong;
                }
            }
        }

        switch (btn.name) //Button names
        {
        case "Start":     //Starts the game
            quizManager.StartGame(0);
            mainMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(true);
            break;

        case "Customize":      //Starts the customization window
            customizeMenuPanel.SetActive(true);
            mainMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(false);
            break;

        case "Start2":     //Starts the game from the customization window
            quizManager.StartGame(0);
            mainMenuPanel.SetActive(false);
            customizeMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(true);
            break;

        case "30s":      //gives person 30 seconds on the clock
            quizManager.setTimer(30f);
            quizManager.StartGame(0);
            mainMenuPanel.SetActive(false);
            customizeMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(true);
            gameOverPanel.SetActive(false);
            break;

        case "40s":      //Gives person 40 seconds on the clock
            quizManager.setTimeLimit(40);
            quizManager.StartGame(0);
            mainMenuPanel.SetActive(false);
            customizeMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(true);
            gameOverPanel.SetActive(false);
            break;

        case "50s":      //Gives person 50 seconds on the clock
            quizManager.setTimeLimit(50);
            quizManager.StartGame(0);
            mainMenuPanel.SetActive(false);
            customizeMenuPanel.SetActive(false);
            gameMenuPanel.SetActive(true);
            gameOverPanel.SetActive(false);
            break;
        }
    }