Add IdentifierRef.Pair<TRelation> method

wip/bindgen
copygirl 2 years ago
parent f9fa808d68
commit 1c844f00fd
  1. 11
      src/gaemstone.ECS/IdentifierRef.cs

@ -21,10 +21,17 @@ public unsafe class IdentifierRef
public static IdentifierRef Combine(IdentifierFlags flags, IdentifierRef id) public static IdentifierRef Combine(IdentifierFlags flags, IdentifierRef id)
=> new(id.World, Identifier.Combine(flags, id)); => new(id.World, Identifier.Combine(flags, id));
public static IdentifierRef Pair(World world, Entity relation, Entity target)
=> new(world, Identifier.Pair(relation, target));
public static IdentifierRef Pair(EntityRef relation, EntityRef target)
=> Pair(relation.World, relation, target);
public static IdentifierRef Pair(EntityRef relation, Entity target) public static IdentifierRef Pair(EntityRef relation, Entity target)
=> new(relation.World, Identifier.Pair(relation, target)); => Pair(relation.World, relation, target);
public static IdentifierRef Pair(Entity relation, EntityRef target) public static IdentifierRef Pair(Entity relation, EntityRef target)
=> new(target.World, Identifier.Pair(relation, target)); => Pair(target.World, relation, target);
public static IdentifierRef Pair<TRelation>(EntityRef target)
=> Pair(target.World.LookupByTypeOrThrow<TRelation>(), target);
public EntityRef? AsEntity() public EntityRef? AsEntity()
=> (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null; => (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null;

Loading…
Cancel
Save