using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// GAME 1303 Tier 6 — A conversation, written in the Inspector. Anabasis, Detective Liz,
/// MythoClash intros, Commission Witch order board, Zap Attack hub NPCs.
/// Create -> GAME1303 -> Dialogue.
///
/// A conversation is a list of LINES. Each line has a speaker, text, and optionally
/// CHOICES. A choice can set a flag and jump to another line — that's all branching is.
///
/// HOW TO WRITE ONE
/// 1. Create the asset, add lines. Leave choices empty for ordinary lines; the
/// conversation just runs to the next one.
/// 2. To branch: on the line where the player decides, add 2-3 choices. Each choice's
/// "Go To Line" is the INDEX of the line to jump to (the number shown in the list).
/// Set Go To Line = -1 to end the conversation after that choice.
/// 3. Require Flags on a line skips it if the condition isn't met — the cheapest way to
/// make a character react to what happened earlier ("You're back. Did you find her?").
/// 4. Set Flag on a line records that the player heard it.
///
/// TIP FOR STUDENTS: write the conversation on paper first and number the lines. Branching
/// dialogue is much easier to type in than to invent in the Inspector.
/// </summary>
[CreateAssetMenu(menuName = "GAME1303/Dialogue", fileName = "NewDialogue")]
public class DialogueData : ScriptableObject
{
[System.Serializable]
public class Choice
{
[TextArea(1, 3)] public string text = "...";
[Tooltip("Line index to jump to. -1 ends the conversation.")]
public int goToLine = -1;
[Tooltip("Flag set when this choice is picked.")]
public string setFlag = "";
[Tooltip("Only offered if these flags pass (comma separated, ! to negate).")]
public string requireFlags = "";
}
[System.Serializable]
public class Line
{
public string speaker = "";
[TextArea(2, 5)] public string text = "";
public Sprite portrait;
[Tooltip("Skip this line entirely unless these flags pass (! to negate).")]
public string requireFlags = "";
[Tooltip("Flag set when this line is shown.")]
public string setFlag = "";
[Tooltip("Sound played when the line appears (a voice blip, a door creak).")]
public AudioClip sound;
[Tooltip("Jump somewhere else instead of the next line. -1 = just continue.")]
public int goToLine = -1;
public List<Choice> choices = new List<Choice>();
}
[Header("Conversation")]
public List<Line> lines = new List<Line>();
[Header("Options")]
[Tooltip("Freeze the player while this plays.")]
public bool pausePlayer = true;
[Tooltip("Only playable once per save.")]
public bool oneShot = false;
[Tooltip("Flag set when the conversation finishes.")]
public string setFlagOnComplete = "";
}