You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.9 KiB

using System;
namespace gaemstone.ECS;
/// <summary> Use a custom name or path for this entity instead of the type's name. </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct
| AttributeTargets.Enum | AttributeTargets.Method)]
public class PathAttribute : Attribute
{
public string Value { get; }
public PathAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Struct)]
public class EntityAttribute : Attribute { }
// On types marked as [Relation], this has an effect on the relation's behavior.
// Otherwise this has the same behavior as [Entity], but informs people
[AttributeUsage(AttributeTargets.Struct)]
public class TagAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class ComponentAttribute : Attribute { }
/// <summary>
/// A singleton is a single instance of a [Component] that can be retrieved
/// without explicitly specifying an entity in a query, where it is equivalent
/// to <see cref="SourceAttribute{}"/> with itself as the generic type parameter.
/// </summary>
public class SingletonAttribute : ComponentAttribute { }
/// <summary>
/// Marked entity represents a relationship type.
/// It may be used as the "relation" in a pair.
/// </summary>
/// <remarks>
/// The relationship may have component data associated with
/// it when added to an entity under these circumstances:
/// <list type="bullet">
/// <item>If marked as a <see cref="TagAttribute"/>, does not carry data.</item>
/// <item>If marked as a <see cref="ComponentAttribute"/>, carries the relation's data.</item>
/// <item>If marked with neither, will carry the target's data, if it's a component.</item>
/// </list>
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class RelationAttribute : Attribute { }