namespace Nerfed.Runtime.Scene;
///
/// Root data model for a scene. A scene and a prefab are the same thing —
/// there is no distinction between the two, mirroring Godot's design.
///
public sealed class SceneData
{
/// Incremented when the file format changes in a breaking way.
public int Version { get; set; } = SceneData.CurrentVersion;
public string Name { get; set; } = string.Empty;
public List Entities { get; set; } = new();
/// All user-defined relations between entities in this scene.
public List Relations { get; set; } = new();
public const int CurrentVersion = 1;
}
///
/// Serialized representation of a single entity.
/// The is a scene-local identifier that only exists in the
/// serialized data and is used to reconstruct parent–child and relation references.
/// It is never stored as a component on a live entity.
/// An entity is included if it owns at least one component
/// OR participates in at least one relation.
///
public sealed class SceneEntityData
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Tag { get; set; } = string.Empty;
///
/// Scene-local of this entity's
/// parent, or null if this is a root entity.
///
public Guid? ParentId { get; set; }
public List Components { get; set; } = new();
}
///
/// Serialized representation of a single component value on an entity.
/// is the fully-qualified CLR type name used to resolve the component on load.
/// is the boxed runtime value; each is
/// responsible for converting it to/from its wire format.
///
public sealed class SceneComponentData
{
public string Type { get; set; } = string.Empty;
public ValueType Value { get; set; } = default!;
}
///
/// Serialized representation of a relation between two entities.
/// and reference scene-local values.
/// identifies the relation kind (must be marked with ).
/// holds the relation data payload (may be an empty struct).
///
public sealed class SceneRelationData
{
public string Type { get; set; } = string.Empty;
public Guid EntityA { get; set; }
public Guid EntityB { get; set; }
public ValueType Value { get; set; } = default!;
}