using MessagePack; namespace OECS; /// /// A convenience base struct for relationship components. /// /// The type parameters and /// are phantom types that differentiate relationship kinds at the type level, /// enabling type-safe queries and reverse lookups. /// /// /// /// // Define a "ChildOf" relationship between a child and a parent entity. /// world.AddComponent(child, new Relationship<ChildOf, Parent> /// { /// Target = parent /// }); /// /// // Later, find all children of a parent. /// var children = world.GetSources<Relationship<ChildOf, Parent>>(parent); /// /// /// [MessagePackObject] public struct Relationship : IRelationship where TSelf : struct where TTarget : struct { /// /// The entity that this relationship points to. /// [Key(0)] public Entity Target { get; set; } }