using System; using System.Collections.Generic; using UnityEngine; namespace Jovian.EncounterSystem { /// /// Runtime contract for any encounter authored in the system. /// An encounter aggregates designer-facing metadata, visuals, dialog, and a polymorphic /// payload that expresses its type-specific data. /// public interface IEncounter { /// Stable identity, display name, and designer description. EncounterDefinition EncounterDefinition { get; set; } /// Numeric configuration shared by every encounter kind. EncounterProperties EncounterProperties { get; set; } /// Visual assets displayed when the encounter is presented. EncounterVisuals EncounterVisuals { get; set; } /// Dialog options shown to the player, or null if the encounter has no dialog. EncounterDialogOptionSet EncounterDialogOptionSet { get; set; } /// Type-specific payload (combat, quest, social, ...). Authored via the SubclassSelector drawer. IEncounterKind Kind { get; set; } } /// /// Default concrete encounter. Holds the shared fields and a polymorphic . /// Prefer adding new behaviour by introducing a new rather than subclassing this type. /// [Serializable] public class Encounter : IEncounter { [field: SerializeField] public EncounterDefinition EncounterDefinition { get; set; } [field: SerializeField] public EncounterProperties EncounterProperties { get; set; } [field: SerializeField] public EncounterVisuals EncounterVisuals { get; set; } [field: SerializeField] public EncounterDialogOptionSet EncounterDialogOptionSet { get; set; } [field: SerializeReference, SubclassSelector] public IEncounterKind Kind { get; set; } } /// /// Designer-facing identity for an encounter. is the stable GUID used for /// cross-references (, quest progress, save data); is a /// human-readable slug; and are display strings. /// [Serializable] public class EncounterDefinition { /// Stable GUID, assigned once at creation. Never edit manually. [HideInInspector] public string internalId = Guid.NewGuid().ToString(); /// Designer-authored short slug (e.g. "goblin_ambush"). public string id; /// Display name shown to the player. public string name; /// Flavour text shown when the encounter opens. public string description; } /// /// A single choice presented to the player inside an . /// Events fire in order when the option is picked and are dispatched through . /// [Serializable] public class EncounterDialogOption { /// Option text shown in the UI. Resolved through a shared /// or falls back to inline text. public DialogLineRef text; /// Ordered events executed by the resolver when this option is chosen. [SerializeReference, SubclassSelector] public List events; } /// Visual assets for an encounter. [Serializable] public class EncounterVisuals { public Sprite icon; public Color encounterColor; public Sprite encounterArt; } /// Numeric/tuning configuration shared across every encounter kind. [Serializable] public class EncounterProperties { public int difficulty; } }