|
|
@ -94,13 +94,14 @@ public unsafe class Iterator |
|
|
|
return ecs_field_is_set(ptr, index); |
|
|
|
return ecs_field_is_set(ptr, index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Potentially misleading, doesn't check the field's backing data type. |
|
|
|
|
|
|
|
// The id might be "(Identifier, Name)", but its data type "Identifier". |
|
|
|
public bool FieldIs<T>(int index) |
|
|
|
public bool FieldIs<T>(int index) |
|
|
|
|
|
|
|
=> FieldIs(index, World.LookupByType<T>()); |
|
|
|
|
|
|
|
public bool FieldIs(int index, Identifier id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fixed (ecs_iter_t* ptr = &Value) { |
|
|
|
fixed (ecs_iter_t* ptr = &Value) |
|
|
|
var id = ecs_field_id(ptr, index); |
|
|
|
return ecs_field_id(ptr, index) == id.Value; |
|
|
|
var comp = World.LookupByTypeOrThrow<T>(); |
|
|
|
|
|
|
|
return id == comp.Entity.Value.Data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
public override string ToString() |
|
|
|