EXPERIMENT: try preserving order of indexable set

pull/6/head
cosmonaut 2023-11-16 14:46:29 -08:00
parent d8d021060e
commit 91da645d71
1 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,7 @@ namespace MoonTools.ECS.Collections
return false;
}
/*
var index = indices[element];
if (index != Count - 1)
@ -71,6 +72,18 @@ namespace MoonTools.ECS.Collections
}
count -= 1;
indices.Remove(element);
*/
var index = indices[element];
for (var i = index; i < Count - 1; i += 1)
{
array[i] = array[i + 1];
indices[array[i]] = i;
}
indices.Remove(element);
count -= 1;
return true;
}