Пример #1
0
    /////////////////////////////////////////////////////////
    //                  PROPER THREATS
    //              THREAT PANEL. PROPER SELECTION
    //  Check if the player selection is the appropiate for the device
    //
    /////////////////////////////////////////////////////////

    public void properThreats()
    {
        //Se recogen los Toggles activados y se comprueba si se han activado correctamente y se cuentan
        properCount = 0;
        if (threatDataA.threats[0].ofThreat == 1 && Threat1.GetComponent <Toggle>().isOn == true)
        {
            proper1 = true; correct1 = true;
        }
        if (threatDataA.threats[0].ofThreat == 0 && Threat1.GetComponent <Toggle>().isOn == false)
        {
            proper1 = false; correct1 = true;
        }
        if (threatDataA.threats[1].ofThreat == 1 && Threat2.GetComponent <Toggle>().isOn == true)
        {
            proper2 = true; correct2 = true;
        }
        if (threatDataA.threats[1].ofThreat == 0 && Threat2.GetComponent <Toggle>().isOn == false)
        {
            proper2 = false; correct2 = true;
        }
        if (threatDataA.threats[2].ofThreat == 1 && Threat3.GetComponent <Toggle>().isOn == true)
        {
            proper3 = true; correct3 = true;
        }
        if (threatDataA.threats[2].ofThreat == 0 && Threat3.GetComponent <Toggle>().isOn == false)
        {
            proper3 = false; correct3 = true;
        }
        if (proper1 == false && proper2 == false && proper3 == false && Threat4.GetComponent <Toggle>().isOn == true)
        {
            proper4 = true; correct4 = true;
        }
        if (proper1 == true || proper2 == true || proper3 == true && Threat4.GetComponent <Toggle>().isOn == false)
        {
            proper4 = false; correct4 = true;
        }

        if (correct1 == true && correct2 == true && correct3 == true && correct4 == true && proper4 == true)
        {
            Debug.Log("Salida 1");
            Debug.Log("Apropiados" + proper1 + "  " + proper2 + "   " + proper3 + "   " + proper4);
            Debug.Log("Pulsado" + correct1 + "  " + correct2 + "   " + correct3 + "   " + correct4);
            properCount            = properCount + 1;
            threatsScore           = threatsScore + properCount;
            tScoreDisplayText.text = threatsScore.ToString();
            Debug.Log("deberia ejecutar showThreats");
            cleanCorrectionsToggles();
            hideCorrectionsPanel();
            tryAgain();
        }

        else if (correct1 == true && correct2 == true && correct3 == true && correct4 == true && proper4 != true)

        {
            Debug.Log("Salida 2");
            Debug.Log("Apropiados" + proper1 + "  " + proper2 + "   " + proper3 + "   " + proper4);
            Debug.Log("Pulsado" + correct1 + "  " + correct2 + "   " + correct3 + "   " + correct4);

            if (proper1 == true)
            {
                properCount = properCount + 1;
            }
            if (proper2 == true)
            {
                properCount = properCount + 1;
            }
            if (proper3 == true)
            {
                properCount = properCount + 1;
            }

            //randProper = UnityEngine.Random.Range(1, properCount);
            while (threatDataA.threats[randProper].ofThreat != 1)
            {
                randProper = UnityEngine.Random.Range(1, properCount);
            }
            //Se selecciona la amenaza para la que se van a presentar correciones

            selectedThreat = threatDataA.threats[randProper].threatText;

            threatsScore           = threatsScore + properCount;
            tScoreDisplayText.text = threatsScore.ToString();

            ShowCorrections();
        }
        else
        {
            Debug.Log("Salida 3");
            Debug.Log("Apropiados" + proper1 + "  " + proper2 + "   " + proper3 + "   " + proper4);
            Debug.Log("Pulsado" + correct1 + "  " + correct2 + "   " + correct3 + "   " + correct4);

            SetThreatErrorPanel();
        }
    }