add relation count methods
parent
d3c4c12605
commit
6f50e78188
|
@ -25,8 +25,12 @@ public abstract class EntityComponentReader
|
||||||
protected ReverseSpanEnumerator<EntityId> OutRelations<T>(in EntityId entity) where T : unmanaged => World.OutRelations<T>(entity);
|
protected ReverseSpanEnumerator<EntityId> OutRelations<T>(in EntityId entity) where T : unmanaged => World.OutRelations<T>(entity);
|
||||||
protected EntityId OutRelationSingleton<T>(in EntityId entity) where T : unmanaged => World.OutRelationSingleton<T>(entity);
|
protected EntityId OutRelationSingleton<T>(in EntityId entity) where T : unmanaged => World.OutRelationSingleton<T>(entity);
|
||||||
protected bool HasOutRelation<T>(in EntityId entity) where T : unmanaged => World.HasOutRelation<T>(entity);
|
protected bool HasOutRelation<T>(in EntityId entity) where T : unmanaged => World.HasOutRelation<T>(entity);
|
||||||
|
protected int OutRelationCount<T>(in EntityId entity) where T : unmanaged => World.OutRelationCount<T>(entity);
|
||||||
|
protected EntityId NthOutRelation<T>(in EntityId entity, int n) where T : unmanaged => World.NthOutRelation<T>(entity, n);
|
||||||
|
|
||||||
protected ReverseSpanEnumerator<EntityId> InRelations<T>(in EntityId entity) where T : unmanaged => World.InRelations<T>(entity);
|
protected ReverseSpanEnumerator<EntityId> InRelations<T>(in EntityId entity) where T : unmanaged => World.InRelations<T>(entity);
|
||||||
protected EntityId InRelationSingleton<T>(in EntityId entity) where T : unmanaged => World.InRelationSingleton<T>(entity);
|
protected EntityId InRelationSingleton<T>(in EntityId entity) where T : unmanaged => World.InRelationSingleton<T>(entity);
|
||||||
protected bool HasInRelation<T>(in EntityId entity) where T : unmanaged => World.HasInRelation<T>(entity);
|
protected bool HasInRelation<T>(in EntityId entity) where T : unmanaged => World.HasInRelation<T>(entity);
|
||||||
|
protected int InRelationCount<T>(in EntityId entity) where T : unmanaged => World.InRelationCount<T>(entity);
|
||||||
|
protected EntityId NthInRelation<T>(in EntityId entity, int n) where T : unmanaged => World.NthInRelation<T>(entity, n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,6 +407,18 @@ public class World : IDisposable
|
||||||
return relationStorage.HasOutRelation(entity);
|
return relationStorage.HasOutRelation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int OutRelationCount<T>(in EntityId entity) where T : unmanaged
|
||||||
|
{
|
||||||
|
var relationStorage = GetRelationStorage<T>();
|
||||||
|
return relationStorage.OutRelationCount(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityId NthOutRelation<T>(in EntityId entity, int n) where T : unmanaged
|
||||||
|
{
|
||||||
|
var relationStorage = GetRelationStorage<T>();
|
||||||
|
return relationStorage.OutNth(entity, n);
|
||||||
|
}
|
||||||
|
|
||||||
public ReverseSpanEnumerator<EntityId> InRelations<T>(EntityId entity) where T : unmanaged
|
public ReverseSpanEnumerator<EntityId> InRelations<T>(EntityId entity) where T : unmanaged
|
||||||
{
|
{
|
||||||
var relationStorage = GetRelationStorage<T>();
|
var relationStorage = GetRelationStorage<T>();
|
||||||
|
@ -425,6 +437,18 @@ public class World : IDisposable
|
||||||
return relationStorage.HasInRelation(entity);
|
return relationStorage.HasInRelation(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int InRelationCount<T>(in EntityId entity) where T : unmanaged
|
||||||
|
{
|
||||||
|
var relationStorage = GetRelationStorage<T>();
|
||||||
|
return relationStorage.InRelationCount(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityId NthInRelation<T>(in EntityId entity, int n) where T : unmanaged
|
||||||
|
{
|
||||||
|
var relationStorage = GetRelationStorage<T>();
|
||||||
|
return relationStorage.InNth(entity, n);
|
||||||
|
}
|
||||||
|
|
||||||
// used as a fast path by Archetype.ClearAll and snapshot restore
|
// used as a fast path by Archetype.ClearAll and snapshot restore
|
||||||
internal void FreeEntity(EntityId entityId)
|
internal void FreeEntity(EntityId entityId)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue