Even more DotNet stuff, help

This commit is contained in:
Simon Lübeß
2022-04-26 22:36:27 +02:00
parent ad1b37dc64
commit 8c53f21690
14 changed files with 821 additions and 63 deletions
@@ -0,0 +1,23 @@
namespace DotNetScriptingHelper;
public readonly struct EcsEntity
{
// Binary Format:
// Bits: [0 - 31] [32 - 64]
// Data: Version Index
private readonly ulong _id;
internal uint Version => (uint)_id;
internal uint Index => (uint)(_id >> 32);
public EcsEntity(uint index, uint version)
{
_id = ((ulong)index << 32) | version;
}
public bool IsValid => Index != InvalidEntity.Index;
public static readonly EcsEntity InvalidEntity = new(uint.MaxValue, 0);
}