示例#1
0
    //! Called when the verification action is triggered
    // Calls upon the ResultVerifier class to compare the content of the Glassware with the
    // expected result for the actual phase
    public void VerifyPhase()
    {
        Debug.Log("Pressing button");
        if (currentIndex.Length > 0)                                                         //Case there is a Glassware being verified
        {
            if ((GameObject.Find(currentIndex).GetComponent <Glassware> ()).content != null) //Case there is a content
            //TODO: The parameter is always 0 as it's checking only the first phase. It needs to change for the correct value when phases are changing correctly
            {
                if (ResultVerifier.GetInstance().VerifyResult(0, (GameObject.Find(currentIndex).GetComponent <Glassware> ()).content))                     //Case Product is correct

                //gameController.sendAlert ("Resultado correto! Parabéns!");
                {
                    correctAnswer.SetActive(true);
                }
                else                            //Case Product is NOT correct
                //gameController.sendAlert ("Resultado incorreto.");
                {
                    wrongAnswer.SetActive(true);
                }
            }
            else                        //Case the Glassware is empty (it won't actually happen)
            {
                gameController.sendAlert("A vidraria está vazia!");
            }
        }
        else                    //Case there's no Glassware selected
        {
            gameController.sendAlert("Não há nenhum produto para verificar!");
        }
    }
    /// <summary>
    /// It is called to load the subsequent step of a phase
    /// </summary>
    private void NewStep()
    {
        stepType = (TypeOfStep)int.Parse(currentPhase[actualStep]["typeOfStep"]);
        ResultVerifier.GetInstance().SetVerificationStep(StepType, currentPhase[actualStep]);

        //GameObject.Find ("Experiments Menu").GetComponent<ExperimentMenu> ().ActivatePhaseTab (actualPhase);
        //GameObject.Find ("Journal State").GetComponent<JournalController> ().ActivateStepTab (actualPhase, actualStep);

        if (StepType == TypeOfStep.CompoundClass)
        {
            Debug.Log("1 = CompoundClass");
        }
        if (StepType == TypeOfStep.WhatCompound)
        {
            Debug.Log("2 = WhatCompound");
        }
        if (StepType == TypeOfStep.MolarityCheck)
        {
            Debug.Log("3 = MolarityCheck");
        }
        if (StepType == TypeOfStep.GlasswareCheck)
        {
            Debug.Log("4 = GlasswareCheck");
        }

        //Play starting dialogue according to type of quest, if needed
        //cutsceneController.PlayTransitionCutscene ();
    }
 public static ResultVerifier GetInstance()
 {
     if (instance == null)
     {
         instance = new ResultVerifier();
     }
     return(instance);
 }
示例#4
0
    public void Start()
    {
        cameraState.gameObject.SetActive(false);
        interactiveCanvas.SetActive(false);
        inventory      = GameObject.Find("InventoryManager").GetComponent <InventoryManager> ();
        originalSprite = glassware.sprite;

        correctAnswer.SetActive(false);
        wrongAnswer.SetActive(false);

        ResultVerifier.GetInstance();
        progressController = GameObject.Find("ProgressController").GetComponent <ProgressController> ();

        verifyButton.interactable = false;
    }
示例#5
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();
        }
    }