public void Start() { int choice = 0; int tmp = 0; StorySwitch choiceTmp = new StorySwitch(0); choicesList = new List <int>(); for (int i = 0; i < story.Count; i++) { choiceTmp = story[i][choice].Run(); tmp = choiceTmp.option; if (choiceTmp.END) { break; } if (choiceTmp.levels != 0) { i -= choiceTmp.levels + 1; if (choiceTmp.option == (int)StorySwitches.NULL) { choice = choicesList[i]; } else { choice = choiceTmp.option; } continue; } choicesList.Add(tmp); choice = tmp; if (chapterChange) { chapterChange = false; Start(); break; } } }
public StorySwitch Run() { this.result = function(); return(result); }
public StoryNodeDefault(Func <StorySwitch> callback) { result = new StorySwitch(); result.option = (int)StorySwitches.NULL; function = callback; }