// Update is called once per frame void Update() { if (conversationTime) { if (Input.GetKeyDown(KeyCode.Z)) { UI.conversationText.text = actual; } if (UI.GetPreparedForNewText()) { if (Input.GetKeyDown(KeyCode.Z)) { SpamText(); } } if (options) { if (UI.GetOptionSelected() != -1) { if (UI.GetOptionSelected() == 0) { if (currentNode.GetSomethingToDo() != null && currentNode.GetSomethingToDo().StartsWith("_S_")) { Invoke(currentNode.GetSomethingToDo().Substring(3), 0); } NextNode(currentNode.GetChildNode1()); } else { if (currentNode.GetSomethingToDo() != null && currentNode.GetSomethingToDo().StartsWith("_N_")) { Invoke(currentNode.GetSomethingToDo().Substring(3), 0); } NextNode(currentNode.GetChildNode2()); } UI.UnshowOptionsBox(); } } if (stopConversation) { switch (currentNode.GetMessage()) { case "_dance": UI.FinishedConversation(); nextThingToDo.GetComponent <DancingTestManager>().StartTest(player, camera); break; case "_drink": UI.FinishedConversation(); nextThingToDo.GetComponent <DrinkingTestManager>().StartTest(player, camera); break; case "_endLevel": UI.FinishedConversation(); nextThingToDo.GetComponent <GameManager>().PlayerDone(); break; case "_cancel": CancelConversation(); break; } conversationTime = false; } } else { if (framedConversation && !stopConversation) { StartConversation(); } } }
private void NextNode(ConversationalNode next) { currentNode = next; options = currentNode.GetChildNode2() != null && currentNode.GetExtraCondition() == null; stopConversation = currentNode.GetMessage().StartsWith("_"); }