Skip to content

Commit d660ddd

Browse files
committed
ECS - add EntityUtils.GetRelations(Entity)
1 parent 60a6eee commit d660ddd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ECS/Entity/EntityUtils.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ public static T CopyComponent<T>(T component, Entity source, Entity target)
9090

9191
#endregion
9292

93+
#region relations
94+
public static ComponentTypes GetRelations(Entity entity)
95+
{
96+
var isOwner = entity.store.nodes[entity.Id].isOwner;
97+
if (isOwner == 0) {
98+
return default;
99+
}
100+
ComponentTypes relationTypes = new ComponentTypes();
101+
relationTypes.bitSet.l0 = isOwner & EntityStoreBase.Static.EntitySchema.relationTypes.bitSet.l0;;
102+
return relationTypes;
103+
}
104+
#endregion
105+
93106
// ------------------------------------------- internal methods -------------------------------------------
94107
#region internal - methods
95108
internal static int ComponentCount (this Entity entity) {

0 commit comments

Comments
 (0)