public void SaySomething() { if (speechController == null) { return; } SpeechInsightType speechType = RandomSpeechType(); string speech = speechBank.RandSpeech(opponentIndex, speechType); speechController.CreateSpeech(speech).Destroy(0, scaleSpeed, 0, fadeSpeed); }
public string RandSpeech(int opponentIndex, SpeechInsightType speechType) { string[] arr = null; if (opponentIndex < 0) { arr = genericSpeeches; } else { switch (speechType) { case SpeechInsightType.GENERIC: arr = genericSpeeches; break; case SpeechInsightType.NEGATIVE: arr = speechInsights[opponentIndex].negSpeeches; break; case SpeechInsightType.POSITIVE: arr = speechInsights[opponentIndex].posSpeeches; break; } } if (arr.Length == 0) { arr = genericSpeeches; } if (arr == null) { return(null); } int index = RandFromArray(arr); return(arr[index]); }