public void cleanCorrectionsToggles() { ThreatCorrection1.GetComponentInChildren <Toggle>().isOn = false; ThreatCorrection2.GetComponentInChildren <Toggle>().isOn = false; ThreatCorrection3.GetComponentInChildren <Toggle>().isOn = false; ThreatCorrection4.GetComponentInChildren <Toggle>().isOn = false; }
///////////////////////////////////////////////////////// // PROPER CORRECTIONS // CORRECTIONS PANEL. CHECK SELECTION // Check if the player answers are the correct ones for the threat selected // ///////////////////////////////////////////////////////// public void properCorrections() { //Se recogen los Toggles activados y se comprueba si se han activado correctamente y se cuentan propercCount = 0; if (tCorrectionDataA.corrections[0].isCorrect == 1 && ThreatCorrection1.GetComponent <Toggle>().isOn == true) { properc1 = true; correctc1 = true; } if (tCorrectionDataA.corrections[0].isCorrect == 0 && ThreatCorrection1.GetComponent <Toggle>().isOn == false) { properc1 = false; correctc1 = true; } if (tCorrectionDataA.corrections[1].isCorrect == 1 && ThreatCorrection2.GetComponent <Toggle>().isOn == true) { properc2 = true; correctc2 = true; } if (tCorrectionDataA.corrections[1].isCorrect == 0 && ThreatCorrection2.GetComponent <Toggle>().isOn == false) { properc2 = false; correctc2 = true; } if (tCorrectionDataA.corrections[2].isCorrect == 1 && ThreatCorrection3.GetComponent <Toggle>().isOn == true) { properc3 = true; correctc3 = true; } if (tCorrectionDataA.corrections[2].isCorrect == 0 && ThreatCorrection3.GetComponent <Toggle>().isOn == false) { properc3 = false; correctc3 = true; } if (properc1 == false && properc2 == false && properc3 == false && ThreatCorrection4.GetComponent <Toggle>().isOn == true) { properc4 = true; correctc4 = true; } if (properc1 == true || properc2 == true || properc3 == true && ThreatCorrection4.GetComponent <Toggle>().isOn == false) { properc4 = false; correctc4 = true; } if (correctc1 == true && correctc2 == true && correctc3 == true && correctc4 == true && properc4 == true) { Debug.Log("Salida 1"); Debug.Log("Apropiados" + properc1 + " " + properc2 + " " + properc3 + " " + properc4); Debug.Log("Pulsado" + correctc1 + " " + correctc2 + " " + correctc3 + " " + correctc4); propercCount = propercCount + 1; correctionsScore = correctionsScore + propercCount; cScoreDisplayText.text = correctionsScore.ToString(); Debug.Log("deberia ejecutar showThreats"); cleanCorrectionsToggles(); hideCorrectionsPanel(); needToChangeLevel(); tryAgain(); } else if (correctc1 == true && correctc2 == true && correctc3 == true && correctc4 == true && properc4 != true) { Debug.Log("Salida 2"); Debug.Log("Apropiados" + properc1 + " " + properc2 + " " + properc3 + " " + properc4); Debug.Log("Pulsado" + correctc1 + " " + correctc2 + " " + correctc3 + " " + correctc4); if (properc1 == true) { propercCount = propercCount + 1; } if (properc2 == true) { propercCount = propercCount + 1; } if (properc3 == true) { propercCount = propercCount + 1; } correctionsScore = correctionsScore + propercCount; cScoreDisplayText.text = correctionsScore.ToString(); needToChangeLevel(); tryAgain(); } else { Debug.Log("Salida 3"); Debug.Log("Apropiados" + properc1 + " " + properc2 + " " + properc3 + " " + properc4); Debug.Log("Pulsado" + correctc1 + " " + correctc2 + " " + correctc3 + " " + correctc4); hideCorrectionsPanel(); SetThreatErrorPanel(); } }