|
|
|
@ -39,9 +39,17 @@ public unsafe readonly partial struct Entity<TContext> |
|
|
|
|
public static Entity<TContext> GetOrInvalid(World<TContext> world, Entity value) |
|
|
|
|
=> new(world, value); |
|
|
|
|
public static Entity<TContext>? GetOrNull(World<TContext> world, Entity value) |
|
|
|
|
=> ecs_is_valid(world, value) ? new(world, value) : null; |
|
|
|
|
=> new Entity<TContext>(world, value).ValidOrNull(); |
|
|
|
|
public static Entity<TContext> GetOrThrow(World<TContext> world, Entity value) |
|
|
|
|
=> ecs_is_valid(world, value) ? new(world, value) : throw new InvalidOperationException($"The entity {value} is not valid"); |
|
|
|
|
=> new Entity<TContext>(world, value).ValidOrThrow(); |
|
|
|
|
|
|
|
|
|
public Entity<TContext>? ValidOrNull() => IsValid ? this : null; |
|
|
|
|
public Entity<TContext> ValidOrThrow() => IsValid ? this |
|
|
|
|
: throw new InvalidOperationException($"The entity {this} is not valid"); |
|
|
|
|
|
|
|
|
|
public Entity<TContext>? AliveOrNull() => IsAlive ? this : null; |
|
|
|
|
public Entity<TContext> AliveOrThrow() => IsAlive ? this |
|
|
|
|
: throw new InvalidOperationException($"The entity {this} is not alive"); |
|
|
|
|
|
|
|
|
|
public void Delete() |
|
|
|
|
=> ecs_delete(World, this); |
|
|
|
|