1
This commit is contained in:
@@ -130,7 +130,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||||||
public static event Action<IEntity> OnAdd;
|
public static event Action<IEntity> OnAdd;
|
||||||
public static event Action<IEntity> OnRemove;
|
public static event Action<IEntity> OnRemove;
|
||||||
IEntity[] IEntitiesService.Entities => Entities;
|
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.Register(IEntity entity) => Register(entity);
|
||||||
bool IEntitiesService.UnRegister(IEntity entity) => UnRegister(entity);
|
bool IEntitiesService.UnRegister(IEntity entity) => UnRegister(entity);
|
||||||
|
|
||||||
@@ -141,12 +141,14 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||||||
if (Dictionary.TryRemove(entity.Id))
|
if (Dictionary.TryRemove(entity.Id))
|
||||||
{
|
{
|
||||||
OnRemove?.Invoke(entity);
|
OnRemove?.Invoke(entity);
|
||||||
|
Entities = Dictionary.Values.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (RegisterQueue.TryDequeue(out var entity))
|
while (RegisterQueue.TryDequeue(out var entity))
|
||||||
{
|
{
|
||||||
Dictionary.GetOrAdd(entity.Id,entity);
|
Dictionary.GetOrAdd(entity.Id,entity);
|
||||||
OnAdd?.Invoke(entity);
|
OnAdd?.Invoke(entity);
|
||||||
|
Entities = Dictionary.Values.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user