mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Even more DotNet stuff, help
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user