Exemple #1
0
    public Phrase[] GetRandomPhrases(Utility.Emotions feelingID)
    {
        Phrase[] temp = new Phrase[3];
        int      randEmotion = (int)feelingID, index = 0;
        Phrase   previousPhrase = new Phrase();

        while (index < 3)
        {
            temp[index] = GetRandomPhrase((Utility.Emotions)randEmotion);

            if (index == 0 || !(previousPhrase.GetAnswerPhrase().Equals(temp[index].GetAnswerPhrase())))
            {
                previousPhrase = temp[index];
                index++;
            }

            while (randEmotion == (int)feelingID)
            {
                randEmotion = Random.Range(0, System.Enum.GetValues(typeof(Utility.Emotions)).Length);
            }
        }

        for (int i = 0; i < 5; i++)
        {
            swapLocalArray(temp, Random.Range(0, 3), Random.Range(0, 3));
        }
        return(temp);
    }