public void ClickLeftButton()
 {
     if (displayLeft == answer && this.GetComponent <Image>().sprite != correct)
     {
         this.GetComponent <Image>().sprite = correct;
         player.AddCompleted();
     }
     else if (this.GetComponent <Image>().sprite != correct)
     {
         player.AddMistake();
     }
 }
Exemple #2
0
 public void ConfirmAnswer()
 {
     if (playerLeftAnswer == leftAnswer && playerMiddleAnswer == middleAnswer && playerRightAnswer == rightAnswer && moduleBackground.sprite != CorrectImage)
     {
         Debug.Log("Answer is correct");
         moduleBackground.sprite = CorrectImage;
         player.AddCompleted();
     }
     else if (moduleBackground.sprite != CorrectImage)
     {
         Debug.Log("Answer is wrong");
         player.AddMistake();
     }
 }
 public void OnEndDrag(PointerEventData eventData)
 {
     if (m_Line != null && !m_doNotDraw)
     {
         float distanceCheck = ((Vector3)eventData.position - transform.position).magnitude;
         if (distanceCheck > 20)
         {
             for (int a = 0; a < m_BombModule.GetImageList().Count; a++)
             {
                 float distance = ((Vector3)eventData.position - m_BombModule.GetImageList()[a].transform.position).magnitude;
                 if (distance < 20)
                 {//might use a number instead of localscale if wrong
                     if (m_currWire == 0 && a == 3 || m_currWire == 1 && a == 4 || m_currWire == 2 && a == 5 || m_currWire == 3 && a == 0 || m_currWire == 4 && a == 1 || m_currWire == 5 && a == 2)
                     {
                         m_BombModule.GetCheckImageList()[a]          = true;
                         m_BombModule.GetCheckImageList()[m_currWire] = true;
                         SetLineToPos(m_BombModule.GetImageList()[a].transform.position);
                         Debug.Log("Connected");
                         m_validWire = true;
                         m_BombModule.CheckWireAnswer();
                         break;
                     }
                     else if (!m_BombModule.CheckImageCorrect())
                     {
                         player.AddMistake();
                     }
                 }
             }
         }
         if (!m_validWire)
         {
             Destroy(m_Line.gameObject);
             m_validWire = false;
         }
         else
         {
             for (int a = 0; a < m_BombModule.GetImageList().Count; a++)
             {
                 if (m_BombModule.GetImageList()[a].transform.position == transform.position)
                 {
                     m_BombModule.GetCheckImageList()[a] = true;
                     break;
                 }
             }
         }
     }
 }
Exemple #4
0
    public void CalculateAnswer()
    {
        topLeftRotateAngle     = 90 * (topLeftTextIndex + 1);
        topRightRotateAngle    = 90 * (topRightTextIndex + 1);
        bottomLeftRotateAngle  = 90 * (bottomLeftTextIndex + 1);
        bottomRightRotateAngle = 90 * (bottomRightTextIndex + 1);

        if (SpinObject[0].transform.eulerAngles.z == topLeftRotateAngle &&
            SpinObject[1].transform.eulerAngles.z == topRightRotateAngle &&
            SpinObject[2].transform.eulerAngles.z == bottomLeftRotateAngle &&
            SpinObject[3].transform.eulerAngles.z == bottomRightRotateAngle &&
            moduleBackground.sprite != CorrectImage)
        {
            Debug.Log("Correct");
            moduleBackground.sprite = CorrectImage;
            player.AddCompleted();
        }
        else if (moduleBackground.sprite != CorrectImage)
        {
            player.AddMistake();
        }
    }