Ejemplo n.º 1
0
    /// <summary>
    /// The method is called when the verification action is triggered
    /// </summary>
    /// Calls upon the ResultVerifier class to compare the content of the Glassware with the
    /// expected result for the actual phase.
    /// The call is made by the different methods associated with the different types of steps
    public void VerifyStep()
    {
        bool complete = false;

        switch (progressController.StepType)
        {
        case TypeOfStep.CompoundClass:
            checkCompoundClassCanvas.SetActive(false);
            complete = ResultVerifier.GetInstance().VerifyCheckBox(checkBoxSelected);
            break;

        case TypeOfStep.WhatCompound:
            string compoundAnswer = whatCompoundAnswer.text;
            checkWhatCompoundCanvas.SetActive(false);
            GameObject.Find("GameController").GetComponent <HUDController> ().LockKeys(false);
            complete = ResultVerifier.GetInstance().VerifyTextBox(compoundAnswer);
            break;

        case TypeOfStep.MolarityCheck:
            string molAnswer = molarityAnswer.text;
            checkMolarityValueCanvas.SetActive(false);
            GameObject.Find("GameController").GetComponent <HUDController> ().LockKeys(false);
            complete = ResultVerifier.GetInstance().VerifyTextBox(molAnswer);
            break;

        case TypeOfStep.GlasswareCheck:
            if (currentIndex.Length > 0)               //Case there is a Glassware being verified
            {
                checkGlasswareCanvas.SetActive(false);
                complete = ResultVerifier.GetInstance().VerifyGlassware(GameObject.Find(currentIndex).GetComponent <Glassware>());
            }
            break;
        }
        //Completes the step or shows the wrong-answer animation
        //TODO: Add verification is currentIndex.Length > 0
        if (complete == true)
        {
            progressController.CompleteStep();
        }
        else
        {
            progressController.WrongAnswer();
        }
    }