Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
 public StorySwitch Run()
 {
     this.result = function();
     return(result);
 }
Beispiel #3
0
 public StoryNodeDefault(Func <StorySwitch> callback)
 {
     result        = new StorySwitch();
     result.option = (int)StorySwitches.NULL;
     function      = callback;
 }