public void destroyEnemy()
 {
     _numberEnemys--;
     if (_numberEnemys == 0)
     {
         FindObjectOfType <GuideControlWorm>().desactiveAll();
         ControlMoney.EarnMoney(Random.Range(5, 10));
         Instantiate(_conffeti);
         Invoke("exitScene", 2);
     }
 }
 private void winGame()
 {
     Debug.Log("Ganaste");
     ControlMoney.EarnMoney(Random.Range(5, 10));
     confetti.SetActive(true);
     GetComponent <AudioSource>().Play();
     cameraAudioSource.Stop();
     GameManager.GetInstance();
     fade.permanentFade();
     disableColliders();
     Invoke("nextLevel", 3.5f);
 }
Exemple #3
0
 public void destroyEye()
 {
     if (_listEyes.Count > 0)
     {
         GetComponent <Animator>().SetBool("Damage", false);
         _listEyes[0].SetActive(false);
         _listEyes.RemoveAt(0);
     }
     else
     {
         Instantiate(_cofetti);
         ControlMoney.EarnMoney(Random.Range(10, 15));
         Camera.main.GetComponent <AudioSource>().enabled = false;
         FindObjectOfType <ControlShifts>().GetComponent <AudioSource>().Play();
         GetComponentInChildren <ParticleSystem>().Stop();
         GetComponent <SpriteRenderer>().enabled = false;
     }
 }
Exemple #4
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");
            }
        }
    }