This commit is contained in:
parent
cda86975a0
commit
4b8586110e
|
@ -130,7 +130,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||
public static event Action<IEntity> OnAdd;
|
||||
public static event Action<IEntity> OnRemove;
|
||||
IEntity[] IEntitiesService.Entities => Entities;
|
||||
public static IEntity[] Entities => Dictionary.Values.ToArray();
|
||||
public static IEntity[] Entities { get; private set; }
|
||||
bool IEntitiesService.Register(IEntity entity) => Register(entity);
|
||||
bool IEntitiesService.UnRegister(IEntity entity) => UnRegister(entity);
|
||||
|
||||
|
@ -141,12 +141,14 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||
if (Dictionary.TryRemove(entity.Id))
|
||||
{
|
||||
OnRemove?.Invoke(entity);
|
||||
Entities = Dictionary.Values.ToArray();
|
||||
}
|
||||
}
|
||||
while (RegisterQueue.TryDequeue(out var entity))
|
||||
{
|
||||
Dictionary.GetOrAdd(entity.Id,entity);
|
||||
OnAdd?.Invoke(entity);
|
||||
Entities = Dictionary.Values.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue