|
|
|
@ -9,23 +9,23 @@ public abstract class EntityBase<TReturn> |
|
|
|
|
public abstract TReturn Remove(Identifier id); |
|
|
|
|
public abstract bool Has(Identifier id); |
|
|
|
|
|
|
|
|
|
public TReturn Add(string symbol) => Add(World.LookupSymbolOrThrow(symbol)); |
|
|
|
|
public TReturn Add<T>() => Add(World.LookupOrThrow(typeof(T))); |
|
|
|
|
public TReturn Add(string symbol) => Add(World.LookupBySymbolOrThrow(symbol)); |
|
|
|
|
public TReturn Add<T>() => Add(World.LookupByTypeOrThrow(typeof(T))); |
|
|
|
|
public TReturn Add(Entity relation, Entity target) => Add(Identifier.Pair(relation, target)); |
|
|
|
|
public TReturn Add<TRelation>(Entity target) => Add(World.LookupOrThrow<TRelation>(), target); |
|
|
|
|
public TReturn Add<TRelation, TTarget>() => Add(World.LookupOrThrow<TRelation>(), World.LookupOrThrow<TTarget>()); |
|
|
|
|
public TReturn Add<TRelation>(Entity target) => Add(World.LookupByTypeOrThrow<TRelation>(), target); |
|
|
|
|
public TReturn Add<TRelation, TTarget>() => Add(World.LookupByTypeOrThrow<TRelation>(), World.LookupByTypeOrThrow<TTarget>()); |
|
|
|
|
|
|
|
|
|
public TReturn Remove(string symbol) => Remove(World.LookupSymbolOrThrow(symbol)); |
|
|
|
|
public TReturn Remove<T>() => Remove(World.LookupOrThrow(typeof(T))); |
|
|
|
|
public TReturn Remove(string symbol) => Remove(World.LookupBySymbolOrThrow(symbol)); |
|
|
|
|
public TReturn Remove<T>() => Remove(World.LookupByTypeOrThrow(typeof(T))); |
|
|
|
|
public TReturn Remove(Entity relation, Entity target) => Remove(Identifier.Pair(relation, target)); |
|
|
|
|
public TReturn Remove<TRelation>(Entity target) => Remove(World.LookupOrThrow<TRelation>(), target); |
|
|
|
|
public TReturn Remove<TRelation, TTarget>() => Remove(World.LookupOrThrow<TRelation>(), World.LookupOrThrow<TTarget>()); |
|
|
|
|
public TReturn Remove<TRelation>(Entity target) => Remove(World.LookupByTypeOrThrow<TRelation>(), target); |
|
|
|
|
public TReturn Remove<TRelation, TTarget>() => Remove(World.LookupByTypeOrThrow<TRelation>(), World.LookupByTypeOrThrow<TTarget>()); |
|
|
|
|
|
|
|
|
|
public bool Has(string symbol) => Has(World.LookupSymbolOrThrow(symbol)); |
|
|
|
|
public bool Has<T>() => Has(World.LookupOrThrow(typeof(T))); |
|
|
|
|
public bool Has(string symbol) => Has(World.LookupBySymbolOrThrow(symbol)); |
|
|
|
|
public bool Has<T>() => Has(World.LookupByTypeOrThrow(typeof(T))); |
|
|
|
|
public bool Has(Entity relation, Entity target) => Has(Identifier.Pair(relation, target)); |
|
|
|
|
public bool Has<TRelation>(Entity target) => Has(World.LookupOrThrow<TRelation>(), target); |
|
|
|
|
public bool Has<TRelation, TTarget>() => Has(World.LookupOrThrow<TRelation>(), World.LookupOrThrow<TTarget>()); |
|
|
|
|
public bool Has<TRelation>(Entity target) => Has(World.LookupByTypeOrThrow<TRelation>(), target); |
|
|
|
|
public bool Has<TRelation, TTarget>() => Has(World.LookupByTypeOrThrow<TRelation>(), World.LookupByTypeOrThrow<TTarget>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract T Get<T>(Identifier id); |
|
|
|
@ -36,24 +36,24 @@ public abstract class EntityBase<TReturn> |
|
|
|
|
public abstract ref T GetRefOrThrow<T>(Identifier id) where T : unmanaged; |
|
|
|
|
public abstract void Modified<T>(Identifier id); |
|
|
|
|
|
|
|
|
|
public T Get<T>() => Get<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public T? GetOrNull<T>() where T : unmanaged => GetOrNull<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public T? GetOrNull<T>(T _ = null!) where T : class => GetOrNull<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public ref T GetMut<T>() where T : unmanaged => ref GetMut<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public ref T GetRefOrNull<T>() where T : unmanaged => ref GetRefOrNull<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public ref T GetRefOrThrow<T>() where T : unmanaged => ref GetRefOrThrow<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public void Modified<T>() => Modified<T>(World.LookupOrThrow<T>()); |
|
|
|
|
public T Get<T>() => Get<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public T? GetOrNull<T>() where T : unmanaged => GetOrNull<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public T? GetOrNull<T>(T _ = null!) where T : class => GetOrNull<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public ref T GetMut<T>() where T : unmanaged => ref GetMut<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public ref T GetRefOrNull<T>() where T : unmanaged => ref GetRefOrNull<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public ref T GetRefOrThrow<T>() where T : unmanaged => ref GetRefOrThrow<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
public void Modified<T>() => Modified<T>(World.LookupByTypeOrThrow<T>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract TReturn Set<T>(Identifier id, in T value) where T : unmanaged; |
|
|
|
|
public abstract TReturn Set<T>(Identifier id, T obj) where T : class; |
|
|
|
|
|
|
|
|
|
public TReturn Set<T>(in T value) where T : unmanaged => Set(World.LookupOrThrow<T>(), value); |
|
|
|
|
public TReturn Set<T>(T obj) where T : class => Set(World.LookupOrThrow<T>(), obj); |
|
|
|
|
public TReturn Set<T>(in T value) where T : unmanaged => Set(World.LookupByTypeOrThrow<T>(), value); |
|
|
|
|
public TReturn Set<T>(T obj) where T : class => Set(World.LookupByTypeOrThrow<T>(), obj); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TReturn ChildOf(Entity parent) => Add(World.ChildOf, parent); |
|
|
|
|
public TReturn ChildOf<TParent>() => Add(World.ChildOf, World.LookupOrThrow<TParent>()); |
|
|
|
|
public TReturn ChildOf<TParent>() => Add(World.ChildOf, World.LookupByTypeOrThrow<TParent>()); |
|
|
|
|
|
|
|
|
|
public TReturn Disable() => Add(World.Disabled); |
|
|
|
|
public TReturn Enable() => Remove(World.Disabled); |
|
|
|
|