mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
optimize EcsGroup.Clear & EcsGroup.Inverse
This commit is contained in:
parent
683da38b77
commit
02a0fc02f9
@ -303,11 +303,11 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
return;
|
||||
}
|
||||
_count = 0;
|
||||
for (int i = 0; i < _sparse.Length; i++)
|
||||
for (int i = 0; i < _count; i++)
|
||||
{
|
||||
_sparse[i] = 0;
|
||||
_sparse[_dense[i]] = 0;
|
||||
}
|
||||
_count = 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -510,6 +510,14 @@ namespace DCFApixels.DragonECS
|
||||
#region Inverse
|
||||
public void Inverse()
|
||||
{
|
||||
if(_count == 0)
|
||||
{
|
||||
foreach (var entityID in _source.Entities)
|
||||
{
|
||||
Add_Internal(entityID);
|
||||
}
|
||||
return;
|
||||
}
|
||||
foreach (var entityID in _source.Entities)
|
||||
{
|
||||
if (Has(entityID))
|
||||
|
Loading…
Reference in New Issue
Block a user