Пример #1
0
    private void Start()
    {
        GetComponent <HandlePlayers>().orderPlayersByRank();
        vh = gameObject.GetComponent <VisualsHandler>();

        HandlePlayers hp = GetComponent <HandlePlayers>();

        round = hp.round;
        int friendlyRound = round + 1;

        roundText.text = "ROUND: " + friendlyRound.ToString();

        audioData = GetComponent <AudioSource>();
        round1.Play(0);
    }
Пример #2
0
    void generateNewRound()
    {
        HandlePlayers hp = GetComponent <HandlePlayers>();

        round = hp.round;
        int friendlyRound = round + 1;

        roundText.text = "ROUND: " + friendlyRound.ToString();


        GameObject player = GetComponent <HandlePlayers>().getCurrentPlayer();

        //print("Player" + hp.currentPlayerId.ToString());
        player.GetComponent <Player>().updatePlayerData(wrongTracker);
        wrongTracker = false;
        counter      = 0;

        // Generate New Sentence
        GetComponent <SentenceBehaviour>().getNewSentence(round + 3);
        GetComponent <HandlePlayers>().switchPlayer();
    }
Пример #3
0
    private void Recognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
    {
        word = args.text;
        if (!string.IsNullOrEmpty(word) && word != previousWord)
        {
            if (round == 1)
            {
                round2.Play(0);
                round1.Stop();
            }

            if (round == 3)
            {
                round3.Play(0);
                round2.Stop();
            }

            if (round == 3)
            {
                HandlePlayers hp = GetComponent <HandlePlayers>();
                hp.orderPlayersByRank();
                if (hp.playersPositions.ElementAtOrDefault(0) != null)
                {
                    GameObject winner = hp.playersPositions[0];
                    PlayerPrefs.SetString("Winner", winner.name);
                }
                if (hp.playersPositions.ElementAtOrDefault(1) != null)
                {
                    GameObject runnerup = hp.playersPositions[1];
                    PlayerPrefs.SetString("RunnerUp", runnerup.name);
                }
                if (hp.playersPositions.ElementAtOrDefault(2) != null)
                {
                    GameObject finalist = hp.playersPositions[2];
                    PlayerPrefs.SetString("Finalist", finalist.name);
                }

                SceneManager.LoadScene("Score", LoadSceneMode.Single);
            }

            bool answer = sb.validateWord(word, counter);
            print(answer);
            previousWord = word;
            counter++;
            if (!answer)
            {
                // Handle Here Wrong Sentence
                //print("You f*****g Donkey!");
                audioDataOther.Play(0);
                wrongTracker = true;
                generateNewRound();
                loadKeywords();
            }
            else
            {
                vh.colorWord(word);
                audioData.Play(0);
            }
        }
        if (counter == keywords.Length)
        {
            generateNewRound();
            loadKeywords();
        }
    }