Easy Chapter Generator
EnglishEspañol

Completar únicamente la fila activa exacta

Obtén manager.CurrentChapter y llama a chapter.TryCompleteObjective(manager.CurrentObjectiveId). Devuelve false si el Chapter no está Active, la fila no está activa o el ID no coincide. Un true ejecuta ciclo, persistencia, sonido y avance normales.

Usa runCompletionActions: false solo para marcar Skipped de forma deliberada. No es una finalización silenciosa.

Seleccionar un Chapter de forma deliberada

TrySelectChapter(string) busca un ID exacto e inicia limpio. SelectChapter(int) usa el índice y registra error si no existe. Al cambiar, se desactiva el Chapter anterior, se activa el destino, se reinicia su progreso conocido y comienza.

Para menús e integraciones utiliza ID, no índices. Una selección en la escena actual no equivale a la transferencia guardada de TransitionToScene.

Volver una posición

TryStepBack necesita el ID de la fila actual y que exista una anterior. Devuelve false en la primera posición, fuera de Active o con un ID antiguo. Al aceptar, completa la actual con semántica especial, reinicia la anterior y vuelve a iniciarla.

No es un Undo del mundo

No recrea objetos ni revierte sistemas externos. Añade acciones inversas explícitas para ese contenido.

Los resultados forman parte del flujo

ComandoResultadoRespuesta del código
TryCompleteObjectiveboolMuestra éxito solo con true
TrySelectChapterboolGestiona un ID inexistente
TryStepBackboolDesactiva Atrás cuando no procede
TryFailCurrentChapterChapterFailureResultDistingue cada motivo de rechazo
Operaciones de progresoProgressOperationResultSepara fallo de almacenamiento y éxito jugable

Completar el objetivo activo desde código externo

Dónde colocarlo
Añade este componente al GameObject responsable de la señal externa del juego.
Cuándo llamarlo
Llama a TryCompleteCurrentObjective desde una interacción validada, una confirmación del diálogo o un evento del proyecto.
Comportamiento
El método no busca ID parciales y devuelve false si falta el Manager, el Chapter o el objetivo activo.
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 ExternalObjectiveCompletionExample : MonoBehaviour
{
    public bool TryCompleteCurrentObjective()
    {
        ChapterManager manager = ChapterManager.Instance;
        Chapter chapter = manager != null ? manager.CurrentChapter : null;
        if (chapter == null || !manager.HasActiveObjective)
        {
            return false;
        }

        return chapter.TryCompleteObjective(manager.CurrentObjectiveId);
    }
}

Retroceder una posición de la lista

Dónde colocarlo
Añade este componente a la interfaz o al sistema responsable de una acción Atrás deliberada.
Cuándo llamarlo
Llama a TryReturnToPreviousObjective mientras el Chapter y su objetivo actual estén activos.
Comportamiento
TryStepBack necesita el ID actual exacto y al menos una entrada anterior. No mantiene un historial libre.
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 StepBackExample : MonoBehaviour
{
    public bool TryReturnToPreviousObjective()
    {
        ChapterManager manager = ChapterManager.Instance;
        Chapter chapter = manager != null ? manager.CurrentChapter : null;
        return chapter != null && manager.HasActiveObjective &&
               chapter.TryStepBack(manager.CurrentObjectiveId);
    }
}