fix false positive on filter remove callback
parent
1438188dca
commit
4ff546538b
|
@ -118,11 +118,13 @@ namespace MoonTools.ECS
|
||||||
{
|
{
|
||||||
if (!EntityStorage.HasComponent(entityID, type))
|
if (!EntityStorage.HasComponent(entityID, type))
|
||||||
{
|
{
|
||||||
filterSignatureToEntityIDs[filterSignature].Remove(entityID);
|
if (filterSignatureToEntityIDs[filterSignature].Remove(entityID))
|
||||||
|
{
|
||||||
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
||||||
{
|
{
|
||||||
removeCallback(entityID);
|
removeCallback(entityID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,11 +133,13 @@ namespace MoonTools.ECS
|
||||||
{
|
{
|
||||||
if (EntityStorage.HasComponent(entityID, type))
|
if (EntityStorage.HasComponent(entityID, type))
|
||||||
{
|
{
|
||||||
filterSignatureToEntityIDs[filterSignature].Remove(entityID);
|
if (filterSignatureToEntityIDs[filterSignature].Remove(entityID))
|
||||||
|
{
|
||||||
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
||||||
{
|
{
|
||||||
removeCallback(entityID);
|
removeCallback(entityID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +157,8 @@ namespace MoonTools.ECS
|
||||||
{
|
{
|
||||||
foreach (var filterSignature in filterSignatures)
|
foreach (var filterSignature in filterSignatures)
|
||||||
{
|
{
|
||||||
filterSignatureToEntityIDs[filterSignature].Remove(entityID);
|
if (filterSignatureToEntityIDs[filterSignature].Remove(entityID))
|
||||||
|
{
|
||||||
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
if (removeCallbacks.TryGetValue(filterSignature, out var removeCallback))
|
||||||
{
|
{
|
||||||
removeCallback(entityID);
|
removeCallback(entityID);
|
||||||
|
@ -161,6 +166,7 @@ namespace MoonTools.ECS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void RegisterAddCallback(FilterSignature filterSignature, Action<Entity> callback)
|
public void RegisterAddCallback(FilterSignature filterSignature, Action<Entity> callback)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue