From 14a70f5038364edcd94284ebafc7c08e6f326819 Mon Sep 17 00:00:00 2001 From: copygirl Date: Wed, 16 Nov 2022 22:12:05 +0100 Subject: [PATCH] Add Entity.ID and EntityRef.ID --- src/gaemstone/ECS/Entity.cs | 1 + src/gaemstone/ECS/EntityRef.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gaemstone/ECS/Entity.cs b/src/gaemstone/ECS/Entity.cs index f06cc15..63b2abc 100644 --- a/src/gaemstone/ECS/Entity.cs +++ b/src/gaemstone/ECS/Entity.cs @@ -39,6 +39,7 @@ public readonly struct Entity public static readonly Entity None = default; public readonly ecs_entity_t Value; + public uint ID => (uint)Value.Data; public bool IsSome => Value.Data != 0; public bool IsNone => Value.Data == 0; diff --git a/src/gaemstone/ECS/EntityRef.cs b/src/gaemstone/ECS/EntityRef.cs index 60a6ca1..d1315a0 100644 --- a/src/gaemstone/ECS/EntityRef.cs +++ b/src/gaemstone/ECS/EntityRef.cs @@ -12,6 +12,7 @@ public unsafe sealed class EntityRef { public override Universe Universe { get; } public Entity Entity { get; } + public uint ID => Entity.ID; public bool IsValid => ecs_is_valid(Universe, this); public bool IsAlive => ecs_is_alive(Universe, this);