Easy Chapter Generator
EnglishEspañol

Practical guide: wait for a dialogue system

Goal: advance one Ordered Objective only when an external dialogue reports a confirmed ending. Keep the vendor API in a project integration component. The bridge receives the callback, verifies that the Manager has an Active Objective and its ID equals the expected ID, then calls Chapter.TryCompleteObjective.

  1. 1
    Create an Ordered Objective named for the conversation and keep its generated ID.
  2. 2
    Start the dialogue from On Objective Start or an activated scene controller.
  3. 3
    In the dialogue package's definitive completion callback—not line start, skip request, or UI close—call the bridge with the expected ID.
  4. 4
    Require a true result before showing progression-accepted feedback. Remove callbacks when the bridge disables.

Variant: if the dialogue controller already exposes a parameterless UnityEvent and no typed result is needed, bind it to a linked base Objective.CompleteFromEvent.

Practical guide: release an external animation gate

Goal: make Objective start actions wait until an externally controlled animation ends. Enable Wait For External Animation on the Ordered Objective. Start the animation from an earlier Chapter event or project controller, then call Chapter.SignalExternalAnimationCompleted() exactly once from the final Animation Event or state-machine callback.

The signal releases the gate; it does not complete the Objective. After release, start transport, object activation/deactivation, and On Objective Start run. The Chapter consumes the flag. If the Objective is completed while still waiting, its coroutine is stopped and late start work will not execute.

Variants, reset, and failure modes

Dialogue callback arrives after another Objective is active

The expected-ID guard returns false. Do not complete the new row with a stale callback.

Animation signal arrives before the intended gate

The Chapter-level flag can be consumed by the next waiting row. Emit it from the animation instance belonging to the current position.

Skip and complete callbacks both fire

Coalesce them in the vendor bridge so only the definitive result calls progression.

Need several dialogue conditions

Use MultiActionObjective branches when simultaneous named signals form one condition; use separate Ordered Objectives when they are sequential tasks.

The compiled examples below contain no dependency on a dialogue or animation vendor and use only the public API.

Complete from an external dialogue system

Where to place it
Keep this bridge in the project's dialogue integration assembly, not in the Easy Chapter Generator Core.
When to call it
Call NotifyDialogueFinished from the dialogue package's confirmed completion callback.
Behavior
The bridge requires the exact expected Objective ID and does not depend on any specific dialogue vendor API.
using System;
using System.Collections;
using System.Collections.Generic;
using OverFuture.ChapterObjectiveSystem.Chapters;
using OverFuture.ChapterObjectiveSystem.Events;
using OverFuture.ChapterObjectiveSystem.Objectives;
using OverFuture.ChapterObjectiveSystem.Persistence;
using OverFuture.ChapterObjectiveSystem.Progression;
using UnityEngine;

public sealed class DialogueIntegrationExample : MonoBehaviour
{
    public bool NotifyDialogueFinished(string expectedObjectiveId)
    {
        ChapterManager manager = ChapterManager.Instance;
        Chapter chapter = manager != null ? manager.CurrentChapter : null;
        return chapter != null && manager.HasActiveObjective &&
               string.Equals(
                   manager.CurrentObjectiveId,
                   expectedObjectiveId,
                   StringComparison.Ordinal) &&
               chapter.TryCompleteObjective(expectedObjectiveId);
    }
}

Release an external animation gate

Where to place it
Place this bridge on the Animator controller or animation-event receiver.
When to call it
Call NotifyAnimationFinished once when the configured external animation has ended.
Behavior
The signal releases the current Chapter gate; it does not complete the Objective and has no effect when no active Objective exists.
using System;
using System.Collections;
using System.Collections.Generic;
using OverFuture.ChapterObjectiveSystem.Chapters;
using OverFuture.ChapterObjectiveSystem.Events;
using OverFuture.ChapterObjectiveSystem.Objectives;
using OverFuture.ChapterObjectiveSystem.Persistence;
using OverFuture.ChapterObjectiveSystem.Progression;
using UnityEngine;

public sealed class ExternalAnimationGateExample : MonoBehaviour
{
    public bool NotifyAnimationFinished()
    {
        ChapterManager manager = ChapterManager.Instance;
        Chapter chapter = manager != null ? manager.CurrentChapter : null;
        if (chapter == null || !manager.HasActiveObjective)
        {
            return false;
        }

        chapter.SignalExternalAnimationCompleted();
        return true;
    }
}