public void IconChosen(Icon choice, Image choiceImg) { if (!firstChoice) { FirstChoice(choice); firstChoice = true; DisplayCurrentStory(choiceImg); return; } foreach (var item in storyNode.choices) { if (item.iconRef == choice) { storyNode = item.nextNode; DisplayCurrentStory(choiceImg); //DisplayHistory(choiceColor); if (storyNode.choices.Count == 0) { SendChoice.IconSelectable = false; musicEndings.CheckForEnding(item.nextNode); doneEvent.Invoke(); restartButton.SetActive(true); tuneObj.SetActive(false); } break; } } }
public void CheckForEnding(NodeScriptable node) { Ending foundNode = endings.Find(x => x.node == node); if (foundNode != null) { musicSource.clip = foundNode.clip; musicSource.Play(); } }
void FirstChoice(Icon choice) { foreach (var item in firstChoices) { if (item.iconRef == choice) { storyNode = item.nextNode; break; } } }