fix some bugs with new replay structure
parent
a8669a6c67
commit
4d47a60125
|
@ -47,6 +47,15 @@ namespace Encompass
|
|||
return result;
|
||||
}
|
||||
|
||||
public override void Remove(int entityID)
|
||||
{
|
||||
base.Remove(entityID);
|
||||
foreach (var replayer in CurrentReplayers)
|
||||
{
|
||||
replayer.MarkRemoval(entityID);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ClearAll()
|
||||
{
|
||||
base.ClearAll();
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace Encompass
|
|||
Lookup<TComponent>().ForceRemove(entityID);
|
||||
}
|
||||
|
||||
public void Remove(int entityID)
|
||||
public virtual void Remove(int entityID)
|
||||
{
|
||||
foreach (var entry in Stores.Values)
|
||||
{
|
||||
|
|
|
@ -34,11 +34,16 @@ namespace Encompass
|
|||
upToDateComponentStore.RegisterComponentType<TComponent>();
|
||||
}
|
||||
|
||||
internal void SetComponentStore(ComponentStore componentStore)
|
||||
internal void SetExistingComponentStore(ComponentStore componentStore)
|
||||
{
|
||||
existingComponentStore.SwapWith(componentStore);
|
||||
}
|
||||
|
||||
internal void SetUpToDateComponentStore(ComponentStore componentStore)
|
||||
{
|
||||
upToDateComponentStore.SwapWith(componentStore);
|
||||
}
|
||||
|
||||
internal void RegisterDrawableComponent<TComponent>(int entityID, TComponent component, int layer) where TComponent : struct, IComponent
|
||||
{
|
||||
drawLayerManager.RegisterComponentWithLayer(entityID, component, layer);
|
||||
|
@ -46,7 +51,7 @@ namespace Encompass
|
|||
|
||||
internal void WriteComponents()
|
||||
{
|
||||
SetComponentStore(upToDateComponentStore);
|
||||
SetExistingComponentStore(upToDateComponentStore);
|
||||
upToDateComponentStore.UpdateUsing(immediateComponentStore);
|
||||
immediateComponentStore.ClearAll();
|
||||
}
|
||||
|
@ -209,6 +214,7 @@ namespace Encompass
|
|||
foreach (var entityID in entitiesMarkedForRemoval)
|
||||
{
|
||||
existingComponentStore.Remove(entityID);
|
||||
immediateComponentStore.Remove(entityID);
|
||||
upToDateComponentStore.Remove(entityID);
|
||||
drawLayerManager.UnRegisterEntityWithLayer(entityID);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace Encompass
|
|||
private readonly int entityCapacity;
|
||||
private readonly List<Engine> engines = new List<Engine>();
|
||||
private readonly DirectedGraph<Engine, Unit> engineGraph = GraphBuilder.DirectedGraph<Engine>();
|
||||
private readonly ComponentStore startingComponentStoreForComponentManager;
|
||||
private readonly ComponentStore startingComponentStoreForComponentUpdateManager;
|
||||
private readonly ComponentStore startingExistingComponentStore;
|
||||
private readonly ComponentStore startingUpToDateComponentStore;
|
||||
|
||||
private readonly ComponentManager componentManager;
|
||||
private readonly EntityManager entityManager;
|
||||
|
@ -53,8 +53,8 @@ namespace Encompass
|
|||
entityManager = new EntityManager(componentManager, entityCapacity);
|
||||
renderManager = new RenderManager(entityManager, drawLayerManager);
|
||||
|
||||
startingComponentStoreForComponentManager = new ComponentStore(typeToIndex);
|
||||
startingComponentStoreForComponentUpdateManager = new ComponentStore(typeToIndex);
|
||||
startingExistingComponentStore = new ComponentStore(typeToIndex);
|
||||
startingUpToDateComponentStore = new ComponentStore(typeToIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,8 +89,8 @@ namespace Encompass
|
|||
RegisterComponentType<TComponent>();
|
||||
componentTypesToRegister.Add(typeof(TComponent));
|
||||
|
||||
startingComponentStoreForComponentManager.Set(entity.ID, component);
|
||||
startingComponentStoreForComponentUpdateManager.Set(entity.ID, component);
|
||||
startingExistingComponentStore.Set(entity.ID, component);
|
||||
startingUpToDateComponentStore.Set(entity.ID, component);
|
||||
|
||||
if (component is IDrawableComponent drawableComponent)
|
||||
{
|
||||
|
@ -105,8 +105,8 @@ namespace Encompass
|
|||
{
|
||||
typeToIndex.Add(typeof(TComponent), typeToIndex.Count);
|
||||
componentManager.RegisterComponentType<TComponent>();
|
||||
startingComponentStoreForComponentManager.RegisterComponentType<TComponent>();
|
||||
startingComponentStoreForComponentUpdateManager.RegisterComponentType<TComponent>();
|
||||
startingExistingComponentStore.RegisterComponentType<TComponent>();
|
||||
startingUpToDateComponentStore.RegisterComponentType<TComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,8 @@ namespace Encompass
|
|||
renderManager
|
||||
);
|
||||
|
||||
componentManager.SetComponentStore(startingComponentStoreForComponentManager);
|
||||
componentManager.SetExistingComponentStore(startingExistingComponentStore);
|
||||
componentManager.SetUpToDateComponentStore(startingUpToDateComponentStore);
|
||||
|
||||
trackingManager.InitializeTracking(entityManager.EntityIDs);
|
||||
|
||||
|
|
Loading…
Reference in New Issue