private string getRandomWord(LoveLetterManager.WordType type) { List <string> words = new List <string>(); switch (type) { case LoveLetterManager.WordType.NOUN: words = nouns; break; case LoveLetterManager.WordType.VERB: words = verbs; break; case LoveLetterManager.WordType.ADJECTIVE: words = adjectives; break; } int rand = Random.Range(0, words.Count - 1); if (rand == lastIndexToAvoidRepeats) { rand++; } lastIndexToAvoidRepeats = rand; return(words[rand]); }
public Word(string word, LoveLetterManager.WordType type) { thisWord = word; this.type = type; }
public void GetNewWord() { LoveLetterManager.WordType wordType = currentSentence.getWordType(); currentWord = new Word(getRandomWord(wordType), wordType); renderW(); }