コード例 #1
0
    public void False()
    {
        gameIsGoing = false;
        if (!statementIsTrue)
        {
            backGround.color = green;
            game.SetActive(false);
            int roundScore = (int)(200 - (timeToAnswer));
            timeToAnswer = 0;
            if (roundScore < 10)
            {
                roundScore = 10;
            }
            totalScore   += roundScore;
            currentScore += roundScore;
            Camera.main.GetComponent <Animator>().SetTrigger("Shake");
            antonymsSfxManager.PlayAudio(true);

            Invoke("SetUpRound", 1f);
        }
        else
        {
            backGround.color = red;
            game.SetActive(false);
            antonymsSfxManager.PlayAudio(false);
            Invoke("SetUpRound", 1f);
        }
        timeToAnswer = 0;
    }
 public void MakeAGuess(int guess)
 {
     if ((hasChanged && guess == 1) || (!hasChanged && guess == 0))
     {
         int score = 80 + (int)(100 - (timer * 10));
         antonymsSfxManager.PlayAudio(true);
         scores.Add(score);
         times.Add(timer);
         scoreKeeper.memoryPoints += score;
         if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
         {
             scoreKeeper.memoryLevel++;
         }
         saveLoader.SaveGameData();
         backGround.material.color = Color.green;
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
     }
     else
     {
         scoreKeeper.memoryPoints += 0;
         scores.Add(0);
         antonymsSfxManager.PlayAudio(false);
         times.Add(timer);
         if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
         {
             scoreKeeper.memoryLevel++;
         }
         saveLoader.SaveGameData();
         backGround.material.color = Color.red;
     }
     buttons.SetActive(false);
     Invoke("StartNewRound2", 0.1f);
 }
コード例 #3
0
    public void MakeAGuess(bool _hasChanged)
    {
        gameContainer.SetActive(false);
        if (currentRound > maxRounds)
        {
            EndGame();
        }
        else
        {
            currentRound++;
            gameIsGoing = false;

            if (_hasChanged == hasChanged)
            {
                Camera.main.GetComponent <Animator>().SetTrigger("Shake");
                background.material.color = green;
                antonymsSfxManager.PlayAudio(true);
                int scoreToAdd = 100 + (int)(100 - timer);
                times.Add(timer);
                timer = 0;
                scores.Add(scoreToAdd);
                scoreKeeper.logicPoints += scoreToAdd;
            }
            else
            {
                background.material.color = red;
                times.Add(timer);
                antonymsSfxManager.PlayAudio(false);
                timer = 0;
                scores.Add(0);
            }
            saveLoader.SaveGameData();
            Invoke("SetupGame", 1f);
        }
    }
コード例 #4
0
 public void Guess(int id)
 {
     if (canAnswer)
     {
         canAnswer = false;
         if (id != 11)
         {
             if (id == currentAnswer)
             {
                 scoreKeeper.memoryPoints += 400;
                 scores.Add(400);
                 antonymsSfxManager.PlayAudio(true);
                 Camera.main.GetComponent <Animator>().SetTrigger("Shake");
                 if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
                 {
                     scoreKeeper.memoryLevel++;
                 }
                 saveLoader.SaveGameData();
                 background.material.color = Color.green;
             }
             else
             {
                 scores.Add(0); background.material.color = Color.red; antonymsSfxManager.PlayAudio(false);
             }
         }
         else
         {
             if (currentAnswer > 9)
             {
                 scoreKeeper.memoryPoints += 400;
                 scores.Add(400);
                 Camera.main.GetComponent <Animator>().SetTrigger("Shake");
                 antonymsSfxManager.PlayAudio(true);
                 if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
                 {
                     scoreKeeper.memoryLevel++;
                 }
                 saveLoader.SaveGameData();
                 background.material.color = Color.green;
             }
             else
             {
                 scores.Add(0); background.material.color = Color.red; antonymsSfxManager.PlayAudio(false);
             }
         }
         Invoke("SetupRound", 1);
     }
 }
 public void True()
 {
     gameIsGoing = false;
     if (statementIsTrue)
     {
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
         antonymsSfxManager.PlayAudio(true);
         backGround.material.color = green;
         game.SetActive(false);
         times.Add(timeToAnswer);
         int roundScore = (int)(200 - (timeToAnswer * 5));
         timeToAnswer = 0;
         if (roundScore < 10)
         {
             roundScore = 10;
         }
         scores.Add(roundScore);
         currentScore += roundScore;
         if (currentQuestion >= questionsTillDone)
         {
             Invoke("EndGame", 1f);
         }
         else
         {
             Invoke("SetUpRound", 1f);
         }
     }
     else
     {
         backGround.material.color = red;
         antonymsSfxManager.PlayAudio(false);
         game.SetActive(false);
         times.Add(timeToAnswer);
         int roundScore = 0;
         timeToAnswer = 0;
         scores.Add(roundScore);
         currentScore -= roundScore;
         if (currentQuestion >= questionsTillDone)
         {
             Invoke("EndGame", 1f);
         }
         else
         {
             Invoke("SetUpRound", 1f);
         }
     }
 }
コード例 #6
0
 private void OnMouseDown()
 {
     antonymsSfxManager.PlayAudio(true);
     hitTheLightsGame.totalScore += 100;
     hitTheLightsGame.StartRound();
     Camera.main.GetComponent <Animator>().SetTrigger("Shake");
     Destroy(gameObject);
 }
 public void Guess(int id)
 {
     guessId = id;
     if (id == correctId)
     {
         totalScore += 100 - (int)(timer * 5) + 50;
         ColorIt();
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
         antonymsSfxManager.PlayAudio(true);
     }
     else
     {
         totalScore -= 5;
         antonymsSfxManager.PlayAudio(false);
         ColorIt();
     }
 }
コード例 #8
0
    public void Guess(int id)
    {
        if (canAnswer)
        {
            switch (currentAnswerId)
            {
            case 0:
                button1Image.color = Color.green; button2Image.color = Color.red; button3Image.color = Color.red; button4Image.color = Color.red; button5Image.color = Color.red;
                break;

            case 1:
                button1Image.color = Color.red; button2Image.color = Color.green; button3Image.color = Color.red; button4Image.color = Color.red; button5Image.color = Color.red;
                break;

            case 2:
                button1Image.color = Color.red; button2Image.color = Color.red; button3Image.color = Color.green; button4Image.color = Color.red; button5Image.color = Color.red;
                break;

            case 3:
                button1Image.color = Color.red; button2Image.color = Color.red; button3Image.color = Color.red; button4Image.color = Color.green; button5Image.color = Color.red;
                break;

            case 4:
                button1Image.color = Color.red; button2Image.color = Color.red; button3Image.color = Color.red; button4Image.color = Color.red; button5Image.color = Color.green;
                break;
            }

            if (id == currentAnswerId)
            {
                antonymsSfxManager.PlayAudio(true);
                Camera.main.GetComponent <Animator>().SetTrigger("Shake");
                scoreKeeper.concentrationPoints += 100;
                scores.Add(100);
                if (scoreKeeper.concentrationPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.concentrationLevel + 1])
                {
                    scoreKeeper.concentrationLevel++;
                }
                saveLoader.SaveGameData();
            }
            else
            {
                scores.Add(0); antonymsSfxManager.PlayAudio(false);
            }
            Invoke("SetupRound", 1);
        }
    }
コード例 #9
0
 private void OnMouseDown()
 {
     if (pickTheCardWithPictures.canTry)
     {
         antonymsSfxManager.PlayAudio(false);
         pickTheCardWithPictures.canTry = false;
         GetComponent <SpriteRenderer>().material.color = Color.white;
     }
 }
    public void Guess(int id)
    {
        if (canAnswer)
        {
            canAnswer = false;
            switch (currentAnswerId)
            {
            case 0:
                button1Text.color = Color.green; button2Text.color = Color.red; button3Text.color = Color.red; button4Text.color = Color.red;
                break;

            case 1:
                button1Text.color = Color.red; button2Text.color = Color.green; button3Text.color = Color.red; button4Text.color = Color.red;
                break;

            case 2:
                button1Text.color = Color.red; button2Text.color = Color.red; button3Text.color = Color.green; button4Text.color = Color.red;
                break;

            case 3:
                button1Text.color = Color.red; button2Text.color = Color.red; button3Text.color = Color.red; button4Text.color = Color.green;
                break;
            }

            if (id == currentAnswerId)
            {
                Camera.main.GetComponent <Animator>().SetTrigger("Shake");
                antonymsSfxManager.PlayAudio(true);
                scoreKeeper.languagePoints += 100;
                scores.Add(100);
                if (scoreKeeper.languagePoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.languageLevel + 1])
                {
                    scoreKeeper.languageLevel++;
                }
                saveLoader.SaveGameData();
            }
            else
            {
                scores.Add(0); antonymsSfxManager.PlayAudio(false);
            }
            Invoke("StartNewRound", 1);
        }
    }
コード例 #11
0
 public void GuessLetter(string letter)
 {
     currentRound++;
     if (letter.ToCharArray()[0] == currentString[index - 1])
     {
         scoreKeeper.memoryPoints += 100;
         scores.Add(100);
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
         saveLoader.SaveGameData();
         antonymsSfxManager.PlayAudio(true);
     }
     else
     {
         scores.Add(0); antonymsSfxManager.PlayAudio(false);
     }
     if (currentRound >= 10)
     {
         questionObject.SetActive(false);
         answerObject.SetActive(false);
         endScreen.SetActive(true);
         endText.text = "";
         for (int i = 1; i < maxRounds + 1; i++)
         {
             endText.text += "Round :" + i + " | Score " + scores[i - 1];
             endText.text += "\n";
         }
         endText.text += "\n";
         endText.text += "Well Done! Keep Improving :)";
     }
     else
     {
         answerObject.SetActive(false);
         questionObject.SetActive(true);
         questionText.text = GenerateRandomString(scoreKeeper.memoryLevel + 3);
         runClock          = true;
     }
     if (scoreKeeper.memoryPoints >= scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
     {
         scoreKeeper.memoryLevel++;
     }
 }
コード例 #12
0
 public void Press()
 {
     if (canBePressed)
     {
         scoreKeeper.concentrationPoints += 100;
         totalScore += 100;
         saveLoader.SaveGameData();
         SwitchColor();
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
         antonymsSfxManager.PlayAudio(true);
         scoreText.text = totalScore.ToString("0");
     }
     else
     {
         scoreKeeper.concentrationPoints += 5;
         totalScore -= 5;
         antonymsSfxManager.PlayAudio(false);
         saveLoader.SaveGameData();
         scoreText.text = totalScore.ToString("0");
     }
 }
コード例 #13
0
 private void OnMouseDown()
 {
     if (findTheFlowerAmong.gameIsGoing)
     {
         antonymsSfxManager.PlayAudio(false);
         findTheFlowerAmong.totalScore -= 50;
         findTheFlowerAmong.scores.Add(0);
         findTheFlowerAmong.times.Add(findTheFlowerAmong.timer);
         background.GetComponent <SpriteRenderer>().material.color = red;
         findTheFlowerAmong.gameIsGoing = false;
         findTheFlowerAmong.Invoke("StartNewRound", 1f);
     }
 }
コード例 #14
0
    private void OnMouseDown()
    {
        if (pickTheCardWithPictures.canTry)
        {
            pickTheCardWithPictures.tryCount++;
            scoreKeeper.concentrationPoints += 100;

            Camera.main.GetComponent <Animator>().SetTrigger("Shake");
            antonymsSfxManager.PlayAudio(true);
            pickTheCardWithPictures.totalScore += 100;
            saveLoader.SaveGameData();
            GetComponent <SpriteRenderer>().material.color = Color.yellow;
        }
    }
コード例 #15
0
 private void OnMouseDown()
 {
     scoreKeeper.reactionPoints += 10;
     antonymsSfxManager.PlayAudio(true);
     if (scoreKeeper.reactionPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.reactionLevel + 1])
     {
         scoreKeeper.reactionLevel++;
     }
     saveLoader.SaveGameData();
     leafBlower.totalScoreCollected += 10;
     Instantiate(explosion, transform.position, Quaternion.identity);
     Camera.main.GetComponent <Animator>().SetTrigger("Shake");
     Destroy(gameObject);
 }
コード例 #16
0
 private void OnMouseDown()
 {
     if (findTheFlowerAmong.gameIsGoing)
     {
         int score = 100 - (int)(findTheFlowerAmong.timer * 5) + 50;
         findTheFlowerAmong.totalScore += score;
         antonymsSfxManager.PlayAudio(true);
         findTheFlowerAmong.scores.Add(score);
         findTheFlowerAmong.times.Add(findTheFlowerAmong.timer);
         background.GetComponent <SpriteRenderer>().material.color = green;
         findTheFlowerAmong.Invoke("StartNewRound", 1f);
         findTheFlowerAmong.gameIsGoing = false;
         Camera.main.GetComponent <Animator>().SetTrigger("Shake");
     }
 }
 public void Answer(int number)
 {
     if (firstNumberText.text == "")
     {
         firstNumberText.text = number.ToString();
         if (number == currentRoundNumbers[0])
         {
             scores.Add(20);
             antonymsSfxManager.PlayAudio(true);
             scoreKeeper.memoryPoints += 20;
             if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
             {
                 scoreKeeper.memoryLevel++;
             }
             saveLoader.SaveGameData();
             firstNumberText.color = Color.green;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
         }
         else
         {
             scores.Add(0);
             firstNumberText.color = Color.red;
             antonymsSfxManager.PlayAudio(false);
         }
     }
     else if (secondNumberText.text == "")
     {
         secondNumberText.text = number.ToString();
         if (number == currentRoundNumbers[1])
         {
             scores[currentRound - 1] += 20;
             scoreKeeper.memoryPoints += 20;
             if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
             {
                 scoreKeeper.memoryLevel++;
             }
             saveLoader.SaveGameData();
             secondNumberText.color = Color.green;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
             antonymsSfxManager.PlayAudio(true);
         }
         else
         {
             secondNumberText.color = Color.red;
             antonymsSfxManager.PlayAudio(false);
         }
     }
     else if (thirdNumberText.text == "")
     {
         thirdNumberText.text = number.ToString();
         if (number == currentRoundNumbers[2])
         {
             scores[currentRound - 1] += 20;
             scoreKeeper.memoryPoints += 20;
             if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
             {
                 scoreKeeper.memoryLevel++;
             }
             saveLoader.SaveGameData();
             thirdNumberText.color = Color.green;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
             antonymsSfxManager.PlayAudio(true);
         }
         else
         {
             thirdNumberText.color = Color.red;
             antonymsSfxManager.PlayAudio(false);
         }
     }
     else if (fourthNumberText.text == "")
     {
         fourthNumberText.text = number.ToString();
         if (number == currentRoundNumbers[3])
         {
             scores[currentRound - 1] += 20;
             scoreKeeper.memoryPoints += 20;
             if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
             {
                 scoreKeeper.memoryLevel++;
             }
             saveLoader.SaveGameData();
             fourthNumberText.color = Color.green;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
             antonymsSfxManager.PlayAudio(true);
         }
         else
         {
             fourthNumberText.color = Color.red;
             antonymsSfxManager.PlayAudio(false);
         }
     }
     else if (fifthNumberText.text == "")
     {
         fifthNumberText.text = number.ToString();
         if (number == currentRoundNumbers[4])
         {
             scores[currentRound - 1] += 20;
             scoreKeeper.memoryPoints += 20;
             if (scoreKeeper.memoryPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.memoryLevel + 1])
             {
                 scoreKeeper.memoryLevel++;
             }
             saveLoader.SaveGameData();
             fifthNumberText.color = Color.green;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
             antonymsSfxManager.PlayAudio(true);
         }
         else
         {
             fifthNumberText.color = Color.red;
             antonymsSfxManager.PlayAudio(false);
         }
         if (currentRound >= maxRounds)
         {
             EndGame();
         }
         else
         {
             currentRound++;
             SetupRound();
         }
     }
 }
コード例 #18
0
    public void Answer(int index)
    {
        if (canAnswer)
        {
            canAnswer = false;
            if (correctIndex == index)
            {
                Camera.main.GetComponent <Animator>().SetTrigger("Shake");

                int roundScore = (int)(200 - (5 * timer));
                antonymsSfxManager.PlayAudio(true);
                if (roundScore < 10)
                {
                    roundScore = 10;
                }
                times.Add(timer);
                timer = 0;
                scoreKeeper.logicPoints += roundScore;
                scores.Add(roundScore);
                if (scoreKeeper.logicPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.logicLevel + 1])
                {
                    scoreKeeper.logicLevel++;
                }
                saveLoader.SaveGameData();
            }
            else
            {
                scores.Add(0); times.Add(timer); timer = 0; antonymsSfxManager.PlayAudio(false);
            }
            if (currentRound >= maxRounds)
            {
                EndGame();
            }
            else
            {
                currentRound++;
                switch (correctIndex)
                {
                case 0:
                    button1Text.color = Color.green;
                    button2Text.color = Color.red;
                    button3Text.color = Color.red;
                    button4Text.color = Color.red;
                    break;

                case 1:
                    button1Text.color = Color.red;
                    button2Text.color = Color.green;
                    button3Text.color = Color.red;
                    button4Text.color = Color.red;
                    break;

                case 2:
                    button1Text.color = Color.red;
                    button2Text.color = Color.red;
                    button3Text.color = Color.green;
                    button4Text.color = Color.red;
                    break;

                case 3:
                    button1Text.color = Color.red;
                    button2Text.color = Color.red;
                    button3Text.color = Color.red;
                    button4Text.color = Color.green;
                    break;
                }
                Invoke("SetupQuestion", 1);
            }
        }
    }
 public void Guess(string character)
 {
     if (word.IndexOf(character) != -1)
     {
         antonymsSfxManager.PlayAudio(true);
         if (word.IndexOf(character) == 0)
         {
             firstLetter.text = word[0].ToString().ToUpper();
         }
         if (word.IndexOf(character) == 1)
         {
             secondLetter.text = word[1].ToString().ToUpper();
         }
         if (word.IndexOf(character) == 2)
         {
             thirdLetter.text = word[2].ToString().ToUpper();
         }
         if (word.IndexOf(character) == 3)
         {
             fourthLetter.text = word[3].ToString().ToUpper();
         }
         if (word.IndexOf(character) == 4)
         {
             fifthLetter.text = word[4].ToString().ToUpper();
         }
         if (firstLetter.text != "_" && secondLetter.text != "_" && thirdLetter.text != "_" && fourthLetter.text != "_" && fifthLetter.text != "_")
         {
             totalScore += 1000;
             scoreKeeper.multitaskingPoints += 1000;
             speed          = 0.8f;
             spawnFrequency = 4f;
             Camera.main.GetComponent <Animator>().SetTrigger("Shake");
             if (scoreKeeper.multitaskingPoints > scoreKeeper.pointsRequiredForLevel[scoreKeeper.multitaskingLevel + 1])
             {
                 scoreKeeper.multitaskingLevel++;
             }
             saveLoader.SaveGameData();
             word              = fiveLetterWords[Random.Range(0, fiveLetterWords.Length)];
             life1.color       = Color.green;
             life2.color       = Color.green;
             life3.color       = Color.green;
             life4.color       = Color.green;
             life5.color       = Color.green;
             life6.color       = Color.green;
             life7.color       = Color.green;
             life8.color       = Color.green;
             life9.color       = Color.green;
             life10.color      = Color.green;
             firstLetter.text  = "_";
             secondLetter.text = "_";
             thirdLetter.text  = "_";
             fourthLetter.text = "_";
             fifthLetter.text  = "_";
         }
     }
     else
     {
         antonymsSfxManager.PlayAudio(false);
         if (life1.color == Color.green)
         {
             life1.color = Color.red;
         }
         else if (life2.color == Color.green && life1.color == Color.red)
         {
             life2.color = Color.red;
         }
         else if (life3.color == Color.green && life2.color == Color.red && life1.color == Color.red)
         {
             life3.color = Color.red;
         }
         else if (life4.color == Color.green && life3.color == Color.red)
         {
             life4.color = Color.red;
         }
         else if (life5.color == Color.green && life4.color == Color.red)
         {
             life5.color = Color.red;
         }
         else if (life5.color == Color.red && life6.color == Color.green)
         {
             life6.color = Color.red;
         }
         else if (life6.color == Color.red && life7.color == Color.green)
         {
             life7.color = Color.red;
         }
         else if (life7.color == Color.red && life8.color == Color.green)
         {
             life8.color = Color.red;
         }
         else if (life8.color == Color.red && life9.color == Color.green)
         {
             life9.color = Color.red;
         }
         else
         {
             life10.color = Color.red;
             EndGame();
         }
     }
 }