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.
53 lines
1.9 KiB
53 lines
1.9 KiB
using System; |
|
using static gaemstone.Flecs.Core; |
|
|
|
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)] |
|
public class PathAttribute : Attribute |
|
{ |
|
public string Value { get; } |
|
public PathAttribute(string value) => Value = value; |
|
} |
|
|
|
/// <summary> |
|
/// Register the entity under a globally unique symbol. |
|
/// Uses the type's name by default. |
|
/// </summary> |
|
// TODO: Remove [Symbol], introduce [Public] for modules and [Private] or so. |
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)] |
|
public class SymbolAttribute : Attribute { } |
|
|
|
|
|
/// <summary> |
|
/// Marked entity automatically has the specified entity added to it when |
|
/// automatically registered. Equivalent to <see cref="EntityBase.Add{T}"/>. |
|
/// </summary> |
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = true)] |
|
public class AddAttribute<TEntity> : Attribute { } |
|
|
|
/// <summary> |
|
/// Marked entity automatically has the specified relationship pair added to it when |
|
/// automatically registered. Equivalent to <see cref="EntityBase.Add{TRelation, TTarget}"/>. |
|
/// </summary> |
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = true)] |
|
public class AddAttribute<TRelation, TTarget> : Attribute { } |
|
|
|
|
|
/// <seealso cref="IsA"/> |
|
public class IsAAttribute<TTarget> : AddAttribute<IsA, TTarget> { } |
|
|
|
/// <seealso cref="ChildOf"/> |
|
public class ChildOfAttribute<TTarget> : AddAttribute<ChildOf, TTarget> { } |
|
|
|
/// <seealso cref="DependsOn"/> |
|
public class DependsOnAttribute<TTarget> : AddAttribute<DependsOn, TTarget> { } |
|
|
|
/// <seealso cref="Exclusive"/> |
|
public class ExclusiveAttribute : AddAttribute<Exclusive> { } |
|
|
|
/// <seealso cref="With"/> |
|
public class WithAttribute<TTarget> : AddAttribute<With, TTarget> { }
|
|
|