From 619e2b24c6ff8797aed702a77954adfbd40f6f4d Mon Sep 17 00:00:00 2001 From: copygirl Date: Thu, 29 Dec 2022 11:25:53 +0100 Subject: [PATCH] More IdentifierRef.Pair variants --- src/gaemstone.ECS/IdRef.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gaemstone.ECS/IdRef.cs b/src/gaemstone.ECS/IdRef.cs index 2115a70..1099c49 100644 --- a/src/gaemstone.ECS/IdRef.cs +++ b/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(World world, Entity target) + => Pair(world, world.LookupByTypeOrThrow(), target); public static IdRef Pair(EntityRef target) => Pair(target.World.LookupByTypeOrThrow(), target); + public static IdRef Pair(World world) + => Pair(world, world.LookupByTypeOrThrow(), + world.LookupByTypeOrThrow()); public EntityRef? AsEntity() => (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null;