public void Decide() { IEnumerable <ActionLibrary.IAction> possibleActions = rpc.Decide(); ActionLibrary.IAction chosenAction = possibleActions.FirstOrDefault(); if (chosenAction == null) { Console.WriteLine("No action"); //saveToFile(); return; } else { //saveToFile(); switch (chosenAction.Key.ToString()) { case "Speak": Name currentState = chosenAction.Parameters[0]; Name nextState = chosenAction.Parameters[1]; Name meaning = chosenAction.Parameters[2]; Name style = chosenAction.Parameters[3]; var possibleDialogs = GameGlobals.FAtiMAIat.GetDialogueActions(currentState, nextState, meaning, style); int randomUttIndex = UnityEngine.Random.Range(0, possibleDialogs.Count()); var dialog = possibleDialogs[randomUttIndex].Utterance; currSpeeches.Add(invoker.GetName() + ": \"" + StripSpeechSentence(dialog) + "\""); break; default: break; } } }