Beispiel #1
0
    private void InterpretCommand(string command)
    {
        if (command.StartsWith("=>")) //Go to tab
        {
            command = command.Replace("=>", "").Replace(" ", "");
            curLine = keyLines[command];
        }
        else if (command.StartsWith("if"))                                                          //Conditional
        {
            string[] parts     = command.Split(',');                                                //Splits condition from reaction
            string   condition = parts[0].Replace("if ", "").Replace(" ", "");                      //Condition part
            string   action    = parts[1].Replace("do ", "").Replace("then ", "").Replace(" ", ""); //Reaction part
            string[] conds     = condition.Split('&');

            //If all conditions are met, you the action will complete
            foreach (string c in conds)
            {
                if (!DialogueHelper.CheckCondition(c))
                {
                    return;
                }
            }
            InterpretCommand(action);
        }
        else if (command.StartsWith("Quest")) //QuestLogic
        {
            Quest q = DialogueHelper.GetQuestFromCommand(command);
            if (command.Contains(".Finish"))
            {
                GameManager.questManager.FinishQuest(q);
            }
            else if (command.Contains(".Advance") || command.Contains(".Start"))
            {
                GameManager.questManager.AdvanceQuest(q);
            }
        }
    }