@@ -19,7 +19,6 @@ public static partial class EntityExtensions
19
19
/// </summary>
20
20
/// <param name="entity">The <see cref="Entity"/>.</param>
21
21
/// <returns>Its <see cref="Archetype"/>.</returns>
22
-
23
22
[ Pure ]
24
23
public static Archetype GetArchetype ( this in Entity entity )
25
24
{
@@ -32,7 +31,6 @@ public static Archetype GetArchetype(this in Entity entity)
32
31
/// </summary>
33
32
/// <param name="entity">The <see cref="Entity"/>.</param>
34
33
/// <returns>A reference to its <see cref="Chunk"/>.</returns>
35
-
36
34
[ Pure ]
37
35
public static ref readonly Chunk GetChunk ( this in Entity entity )
38
36
{
@@ -45,9 +43,8 @@ public static ref readonly Chunk GetChunk(this in Entity entity)
45
43
/// </summary>
46
44
/// <param name="entity">The <see cref="Entity"/>.</param>
47
45
/// <returns>Its <see cref="ComponentType"/>'s array.</returns>
48
-
49
46
[ Pure ]
50
- public static ComponentType [ ] GetComponentTypes ( this in Entity entity )
47
+ public static Signature GetComponentTypes ( this in Entity entity )
51
48
{
52
49
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
53
50
return world . GetSignature ( entity ) ;
@@ -59,7 +56,6 @@ public static ComponentType[] GetComponentTypes(this in Entity entity)
59
56
/// </summary>
60
57
/// <param name="entity">The <see cref="Entity"/>.</param>
61
58
/// <returns>A newly allocated array containing the entities components.</returns>
62
-
63
59
[ Pure ]
64
60
public static object ? [ ] GetAllComponents ( this in Entity entity )
65
61
{
@@ -72,21 +68,32 @@ public static ComponentType[] GetComponentTypes(this in Entity entity)
72
68
/// </summary>
73
69
/// <param name="entity">The <see cref="Entity"/>.</param>
74
70
/// <returns>True if it exists and is alive, otherwise false.</returns>
75
-
76
71
[ Pure ]
77
72
public static bool IsAlive ( this in Entity entity )
78
73
{
79
74
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
80
75
return world . IsAlive ( entity ) ;
81
76
}
82
77
78
+ /// <summary>
79
+ /// Checks if the <see cref="Entity"/> is alive in this <see cref="World"/>.
80
+ /// </summary>
81
+ /// <param name="entity">The <see cref="Entity"/>.</param>
82
+ /// <param name="exists">If the entity and its <see cref="EntityData"/> exists.</param>
83
+ /// <returns>True if it exists and is alive, otherwise false.</returns>
84
+ [ Pure ]
85
+ public static ref EntityData IsAlive ( this in Entity entity , out bool exists )
86
+ {
87
+ var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
88
+ return ref world . IsAlive ( entity , out exists ) ;
89
+ }
90
+
83
91
/// <summary>
84
92
/// Sets or replaces a component for an <see cref="Entity"/>.
85
93
/// </summary>
86
94
/// <typeparam name="T">The component type.</typeparam>
87
95
/// <param name="entity">The <see cref="Entity"/>.</param>
88
96
/// <param name="component">The instance, optional.</param>
89
-
90
97
public static void Set < T > ( this in Entity entity , in T ? component = default )
91
98
{
92
99
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -203,7 +210,6 @@ public static partial class EntityExtensions
203
210
/// </summary>
204
211
/// <param name="entity">The <see cref="Entity"/>.</param>
205
212
/// <param name="cmp">The component.</param>
206
-
207
213
public static void Set ( this in Entity entity , object cmp )
208
214
{
209
215
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -215,7 +221,6 @@ public static void Set(this in Entity entity, object cmp)
215
221
/// </summary>
216
222
/// <param name="entity">The <see cref="Entity"/>.</param>
217
223
/// <param name="components">The components <see cref="IList{T}"/>.</param>
218
-
219
224
public static void SetRange ( this in Entity entity , Span < object > components )
220
225
{
221
226
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -228,7 +233,6 @@ public static void SetRange(this in Entity entity, Span<object> components)
228
233
/// <param name="entity">The <see cref="Entity"/>.</param>
229
234
/// <param name="type">The component <see cref="ComponentType"/>.</param>
230
235
/// <returns>True if it has the desired component, otherwise false.</returns>
231
-
232
236
[ Pure ]
233
237
public static bool Has ( this in Entity entity , ComponentType type )
234
238
{
@@ -242,7 +246,6 @@ public static bool Has(this in Entity entity, ComponentType type)
242
246
/// <param name="entity">The <see cref="Entity"/>.</param>
243
247
/// <param name="types">The component <see cref="ComponentType"/>.</param>
244
248
/// <returns>True if it has the desired component, otherwise false.</returns>
245
-
246
249
[ Pure ]
247
250
public static bool HasRange ( this in Entity entity , Span < ComponentType > types )
248
251
{
@@ -256,7 +259,6 @@ public static bool HasRange(this in Entity entity, Span<ComponentType> types)
256
259
/// <param name="entity">The <see cref="Entity"/>.</param>
257
260
/// <param name="type">The component <see cref="ComponentType"/>.</param>
258
261
/// <returns>A reference to the component.</returns>
259
-
260
262
[ Pure ]
261
263
public static object ? Get ( this in Entity entity , ComponentType type )
262
264
{
@@ -270,7 +272,6 @@ public static bool HasRange(this in Entity entity, Span<ComponentType> types)
270
272
/// <param name="entity">The <see cref="Entity"/>.</param>
271
273
/// <param name="types">The component <see cref="ComponentType"/>.</param>
272
274
/// <returns>A reference to the component.</returns>
273
-
274
275
[ Pure ]
275
276
public static object ? [ ] GetRange ( this in Entity entity , Span < ComponentType > types )
276
277
{
@@ -286,7 +287,6 @@ public static bool HasRange(this in Entity entity, Span<ComponentType> types)
286
287
/// <param name="types">The component <see cref="ComponentType"/>.</param>
287
288
/// <param name="components">A <see cref="IList{T}"/> where the components are put it.</param>
288
289
/// <returns>A reference to the component.</returns>
289
-
290
290
[ Pure ]
291
291
public static void GetRange ( this in Entity entity , Span < ComponentType > types , Span < object ? > components )
292
292
{
@@ -302,7 +302,6 @@ public static void GetRange(this in Entity entity, Span<ComponentType> types, Sp
302
302
/// <param name="type">The component <see cref="ComponentType"/>.</param>
303
303
/// <param name="component">The found component.</param>
304
304
/// <returns>True if it exists, otherwise false.</returns>
305
-
306
305
[ Pure ]
307
306
public static bool TryGet ( this in Entity entity , ComponentType type , out object ? component )
308
307
{
@@ -316,7 +315,6 @@ public static bool TryGet(this in Entity entity, ComponentType type, out object?
316
315
/// <param name="entity">The <see cref="Entity"/>.</param>
317
316
/// <param name="cmp">The component.</param>
318
317
[ SkipLocalsInit ]
319
-
320
318
public static void Add ( this in Entity entity , in object cmp )
321
319
{
322
320
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -329,7 +327,6 @@ public static void Add(this in Entity entity, in object cmp)
329
327
/// <param name="entity">The <see cref="Entity"/>.</param>
330
328
/// <param name="components">The component <see cref="IList{T}"/>.</param>
331
329
[ SkipLocalsInit ]
332
-
333
330
public static void AddRange ( this in Entity entity , Span < object > components )
334
331
{
335
332
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -342,7 +339,6 @@ public static void AddRange(this in Entity entity, Span<object> components)
342
339
/// <param name="entity">The <see cref="Entity"/>.</param>
343
340
/// <param name="components">A <see cref="Span{T}"/> of <see cref="ComponentType"/>'s, those are added to the <see cref="Entity"/>.</param>
344
341
[ SkipLocalsInit ]
345
-
346
342
public static void AddRange ( this in Entity entity , Span < ComponentType > components )
347
343
{
348
344
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
@@ -355,7 +351,6 @@ public static void AddRange(this in Entity entity, Span<ComponentType> component
355
351
/// <param name="entity">The <see cref="Entity"/>.</param>
356
352
/// <param name="types">A <see cref="IList{T}"/> of <see cref="ComponentType"/>'s, those are removed from the <see cref="Entity"/>.</param>
357
353
[ SkipLocalsInit ]
358
-
359
354
public static void RemoveRange ( this in Entity entity , Span < ComponentType > types )
360
355
{
361
356
var world = World . Worlds . DangerousGetReferenceAt ( entity . WorldId ) ;
0 commit comments