More IdentifierRef.Pair variants

wip/bindgen
copygirl 2 years ago
parent 230d1abfe3
commit 619e2b24c6
  1. 14
      src/gaemstone.ECS/IdRef.cs

@ -26,14 +26,20 @@ public unsafe class IdRef
public static IdRef Pair(World world, Entity relation, Entity target)
=> new(world, Id.Pair(relation, target));
public static IdRef Pair(EntityRef relation, EntityRef target)
=> Pair(relation.World, relation, target);
public static IdRef Pair(EntityRef relation, Entity target)
=> Pair(relation.World, relation, target);
public static IdRef Pair(Entity relation, EntityRef target)
=> Pair(target.World, relation, target);
public static IdRef Pair(EntityRef relation, Entity target)
=> Pair(relation.World, relation, target);
public static IdRef Pair(EntityRef relation, EntityRef target)
=> Pair(relation.World, relation, target);
public static IdRef Pair<TRelation>(World world, Entity target)
=> Pair(world, world.LookupByTypeOrThrow<TRelation>(), target);
public static IdRef Pair<TRelation>(EntityRef target)
=> Pair(target.World.LookupByTypeOrThrow<TRelation>(), target);
public static IdRef Pair<TRelation, TTarget>(World world)
=> Pair(world, world.LookupByTypeOrThrow<TRelation>(),
world.LookupByTypeOrThrow<TTarget>());
public EntityRef? AsEntity()
=> (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null;

Loading…
Cancel
Save