untrack destroyed entities
parent
936b97c4ec
commit
05fa578652
|
@ -718,5 +718,10 @@ namespace Encompass
|
||||||
withMask.Not()
|
withMask.Not()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void RegisterDestroyedEntity(Entity entity)
|
||||||
|
{
|
||||||
|
_trackedEntities.Remove(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,11 @@ namespace Encompass
|
||||||
entitiesMarkedForDestroy.Add(entity);
|
entitiesMarkedForDestroy.Add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DestroyMarkedEntities()
|
public void DestroyMarkedEntities(IEnumerable<Engine> engines)
|
||||||
{
|
{
|
||||||
foreach (var entity in entitiesMarkedForDestroy)
|
foreach (var entity in entitiesMarkedForDestroy)
|
||||||
{
|
{
|
||||||
|
foreach (var engine in engines) { engine.RegisterDestroyedEntity(entity); }
|
||||||
componentManager.MarkAllComponentsOnEntityForRemoval(entity);
|
componentManager.MarkAllComponentsOnEntityForRemoval(entity);
|
||||||
IDs.Remove(entity.ID);
|
IDs.Remove(entity.ID);
|
||||||
idManager.Free(entity.ID);
|
idManager.Free(entity.ID);
|
||||||
|
|
|
@ -70,7 +70,6 @@ namespace Encompass
|
||||||
foreach (var engine in _componentTypesToEngines[componentType])
|
foreach (var engine in _componentTypesToEngines[componentType])
|
||||||
{
|
{
|
||||||
_pairsToCheck.Add((entity, engine));
|
_pairsToCheck.Add((entity, engine));
|
||||||
// engine.CheckTrackEntity(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,6 @@ namespace Encompass
|
||||||
foreach (var engine in _componentTypesToEngines[componentType])
|
foreach (var engine in _componentTypesToEngines[componentType])
|
||||||
{
|
{
|
||||||
_pairsToCheck.Add((entity, engine));
|
_pairsToCheck.Add((entity, engine));
|
||||||
//engine.CheckUntrackEntity(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Encompass
|
||||||
}
|
}
|
||||||
|
|
||||||
messageManager.ClearMessages();
|
messageManager.ClearMessages();
|
||||||
entityManager.DestroyMarkedEntities();
|
entityManager.DestroyMarkedEntities(enginesInOrder);
|
||||||
|
|
||||||
componentManager.WriteComponents();
|
componentManager.WriteComponents();
|
||||||
componentManager.RemoveMarkedComponents();
|
componentManager.RemoveMarkedComponents();
|
||||||
|
|
|
@ -48,12 +48,12 @@ namespace Encompass
|
||||||
this.entityCapacity = entityCapacity;
|
this.entityCapacity = entityCapacity;
|
||||||
drawLayerManager = new DrawLayerManager(typeToIndex);
|
drawLayerManager = new DrawLayerManager(typeToIndex);
|
||||||
timeManager = new TimeManager();
|
timeManager = new TimeManager();
|
||||||
|
trackingManager = new TrackingManager();
|
||||||
componentUpdateManager = new ComponentUpdateManager(typeToIndex);
|
componentUpdateManager = new ComponentUpdateManager(typeToIndex);
|
||||||
componentManager = new ComponentManager(drawLayerManager, componentUpdateManager, typeToIndex);
|
componentManager = new ComponentManager(drawLayerManager, componentUpdateManager, typeToIndex);
|
||||||
messageManager = new MessageManager(timeManager);
|
messageManager = new MessageManager(timeManager);
|
||||||
entityManager = new EntityManager(componentManager, entityCapacity);
|
entityManager = new EntityManager(componentManager, entityCapacity);
|
||||||
renderManager = new RenderManager(entityManager, drawLayerManager);
|
renderManager = new RenderManager(entityManager, drawLayerManager);
|
||||||
trackingManager = new TrackingManager();
|
|
||||||
|
|
||||||
startingComponentStoreForComponentManager = new ComponentStore(typeToIndex);
|
startingComponentStoreForComponentManager = new ComponentStore(typeToIndex);
|
||||||
startingComponentStoreForComponentUpdateManager = new ComponentStore(typeToIndex);
|
startingComponentStoreForComponentUpdateManager = new ComponentStore(typeToIndex);
|
||||||
|
@ -419,9 +419,9 @@ namespace Encompass
|
||||||
var dummyTimeManager = new TimeManager();
|
var dummyTimeManager = new TimeManager();
|
||||||
var dummyMessageManager = new MessageManager(dummyTimeManager);
|
var dummyMessageManager = new MessageManager(dummyTimeManager);
|
||||||
var dummyDrawLayerManager = new DrawLayerManager(typeToIndex);
|
var dummyDrawLayerManager = new DrawLayerManager(typeToIndex);
|
||||||
|
var dummyTrackingManager = new TrackingManager();
|
||||||
var dummyComponentUpdateManager = new ComponentUpdateManager(typeToIndex);
|
var dummyComponentUpdateManager = new ComponentUpdateManager(typeToIndex);
|
||||||
var dummyComponentManager = new ComponentManager(dummyDrawLayerManager, dummyComponentUpdateManager, typeToIndex);
|
var dummyComponentManager = new ComponentManager(dummyDrawLayerManager, dummyComponentUpdateManager, typeToIndex);
|
||||||
var dummyTrackingManager = new TrackingManager();
|
|
||||||
var dummyEntityManager = new EntityManager(dummyComponentManager, entityCapacity);
|
var dummyEntityManager = new EntityManager(dummyComponentManager, entityCapacity);
|
||||||
var dummyRenderManager = new RenderManager(dummyEntityManager, dummyDrawLayerManager);
|
var dummyRenderManager = new RenderManager(dummyEntityManager, dummyDrawLayerManager);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue