Exemplo n.º 1
0
    IEnumerator CorrectAnswerSequence()
    {
        TimerPaused = true;
        yield return(new WaitForSeconds(0.1f));

        theSoundScript.PlayCorrectSound();
        CorrectSign.SetActive(true);
        yield return(new WaitForSeconds(0.5f));

        CorrectSign.SetActive(false);
        LoadingScreen.SetActive(true);
        yield return(new WaitForSeconds(0.5f));

        int BonusToGive = (int)((TimerCounter / 2) * CurrentLevel) + (10 * Life);

        UpdateScore(BonusToGive);
        yield return(new WaitForSeconds(0.5f));

        CurrentLevel += 1;
        yield return(new WaitForSeconds(0.1f));

        SetupItemList();
        yield return(new WaitForSeconds(0.1f));

        LoadingScreen.SetActive(false);
        TimerPaused = false;
    }
Exemplo n.º 2
0
    public void On_ClickAnswer()
    {
        theSoundScript.PlaySelectSound();
        int rightaswer = 0;

        //play sound base on current level
        for (int i = 0; i < PossibleAnswers.Length; i++)
        {
            if (AnswerInput.text == PossibleAnswers[i])
            {
                rightaswer += 1;
            }
        }

        if (rightaswer > 0)
        {
            //right aswer
            theSoundScript.PlayCorrectSound();
            int givingscore = PlayerPrefs.GetInt("Score") + PointsToGive;
            PlayerPrefs.SetInt("CampaignLevelUnlocked", PlayerPrefs.GetInt("CampaignLevelUnlocked") + 1);
            PlayerPrefs.SetInt("Score", givingscore);
            RightScreen.SetActive(true);

            if (CurrentLevel == 10 || CurrentLevel == 20 || CurrentLevel == 30 || CurrentLevel == 40)
            {
                YouGotAmountPointsText.text = "You got " + Mathf.Round(PointsToGive) + " points and 10 coins";
                PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") + 10);
                PlayerPrefs.SetInt("CampaignCoinUnlocked", PlayerPrefs.GetInt("CampaignCoinUnlocked") + 1);
            }
            else if (CurrentLevel == 15 || CurrentLevel == 25 || CurrentLevel == 35)
            {
                switch (CurrentLevel)
                {
                case 15:
                    AvatarDatabase.EyesLocked[7] = false;
                    YouGotAmountPointsText.text  = "You got " + Mathf.Round(PointsToGive) + " points and unlocked Avatar Eyes # 8";
                    break;

                case 25:
                    AvatarDatabase.NoseLocked[4] = false;
                    YouGotAmountPointsText.text  = "You got " + Mathf.Round(PointsToGive) + " points and unlockedv Avatar Nose # 5";
                    break;

                case 35:
                    AvatarDatabase.MouthLocked[4] = false;
                    YouGotAmountPointsText.text   = "You got " + Mathf.Round(PointsToGive) + " points and unlocked Avatar Mouth # 5";
                    break;
                }
            }
            else
            {
                YouGotAmountPointsText.text = "You got " + Mathf.Round(PointsToGive) + " points!";
            }
        }
        else
        {
            //wronganswer
            theSoundScript.PlayWrongSound();
            WrongScreen.SetActive(true);
        }
    }