/// <summary> /// Branches to another dialog chain based on the story choice. /// If the matching dialog chain parameter is null, then does nothing. /// </summary> public static Action BranchStoryChoice(DialogChain choice1, DialogChain choice2, DialogChain choice3, bool force = false) { return(() => { switch (GameScript.choice) { case 1: if (choice1 != null && (force || choice1.TriggerCondition == null || choice1.TriggerCondition(InstanceTracker.GameScript.GetFieldValue <int>("curB")))) { DialogChains.InitiateDialog(choice1); } break; case 2: if (choice2 != null && (force || choice2.TriggerCondition == null || choice2.TriggerCondition(InstanceTracker.GameScript.GetFieldValue <int>("curB")))) { DialogChains.InitiateDialog(choice2); } break; case 3: if (choice3 != null && (force || choice3.TriggerCondition == null || choice3.TriggerCondition(InstanceTracker.GameScript.GetFieldValue <int>("curB")))) { DialogChains.InitiateDialog(choice3); } break; } }); }
/// <summary> /// Branches to another dialog chain as long as the chain's trigger condition is met. /// This chain does not need to have been registered with <see cref="DialogChains.RegisterDialogChain(DialogChain)"/> /// </summary> public static Action BranchDialog(DialogChain chain) { return(() => { if (chain.TriggerCondition == null || chain.TriggerCondition(InstanceTracker.GameScript.GetFieldValue <int>("curB"))) { DialogChains.InitiateDialog(chain); } }); }