Example #1
0
    public void checkAnswer(string answer)
    {
        Sign tempSign;
        bool correctAnswer        = false;
        bool correctPronunciation = false;

        if (isShowingSign)
        {
            foreach (WordList.itemNames possibleAnswer in signsInGame[currentSign].possibleAnswers) //Checks all possible answers for the word or image in sign
            {
                //answer.Equals(possibleAnswer.ToString(), System.StringComparison.OrdinalIgnoreCase)
                if (answer.Equals(possibleAnswer.ToString(), System.StringComparison.OrdinalIgnoreCase))
                {
                    correctAnswer        = true;
                    correctPronunciation = true;
                }

                if (possibleAnswer.ToString() == "LIKEABLE")
                {
                    if (answer.Equals("likable", System.StringComparison.OrdinalIgnoreCase))
                    {
                        correctAnswer        = true;
                        correctPronunciation = true;
                    }
                }
            }

            if (correctPronunciation)
            {
                SaveSystem.increaseMicrophonePressedTime(true, answer, ChangeScene.EspikinglishMinigames.LOVE_SCENE);
            }
            else
            {
                SaveSystem.increaseMicrophonePressedTime(false);
            }

            signText.text = " ";

            if (correctAnswer)
            {
                currentSign++;
                if (currentSign < signsInGame.Count) //Checks cont of how many words has the player said, to know if he won or he should keep going.
                {
                    women.GetComponent <WomanController>().playGoodSoundEffect();
                    chooseExitAnimation(false);
                    women.GetComponent <WomanController>().playLoveAnimation();
                    loveMetter.GetComponent <LoveMeterController>().updateLoveBar();
                }
                else
                {
                    Debug.Log("Ganaste, quedó bien enamorada");
                    chooseExitAnimation(true);
                    audioController.playVictorySound();
                    disableSpeechButton();
                    //finalScreen.SetActive(true);
                    ControlMoney.EarnMoney(Random.Range(5, 10));
                    confetti.Play();
                    loveMetter.GetComponent <LoveMeterController>().updateLoveBar();
                    women.GetComponent <WomanController>().playLoveAnimation();
                    Invoke("nextLevel", audioController.getVictorySoundTime() + 0.4f);
                    winning = true;
                    //FindObjectOfType<FinalScreenController>().winScreenImage();
                }
            }
            else
            {
                contWTF++;
                winning = false;


                tempSign = signsInGame[currentSign];
                signsInGame.RemoveAt(currentSign);
                signsInGame.Add(tempSign);
                women.GetComponent <WomanController>().playWTFAnimation(contWTF);
                //Add wtf bar and check tries to see if loses
                wtfBar.GetComponent <WTFBarController>().updateWTFbar();
                if (contWTF < 3)
                {
                    chooseExitAnimation(false);
                    women.GetComponent <WomanController>().playBadSoundEffect();
                }
                else
                {
                    disableSpeechButton();
                    chooseExitAnimation(true);
                    Invoke("playExitAudio", women.GetComponent <WomanController>().whatSFX.length);
                    signText.enabled = false;
                }

                //finalScreen.SetActive(true);
                //FindObjectOfType<FinalScreenController>().loseScreenImage();
                //Debug.Log("Perdiste");
            }
        }
    }
Example #2
0
 public void eatLeaf()
 {
     ControlMoney.LoseMoney(30);
     _moodControllerScript.eatWithTito();
     backToGarden();
 }