IEnumerator WrongAnswerSequence() { TimerPaused = true; yield return(new WaitForSeconds(0.1f)); theSoundScript.PlayWrongSound(); WrongSign.SetActive(true); yield return(new WaitForSeconds(0.5f)); WrongSign.SetActive(false); UpdateLife(-1); yield return(new WaitForSeconds(0.1f)); if (Life <= 0) { GameOverScreen.SetActive(true); } else { TimerPaused = false; } }
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); } }