fix erroneous engine cycle detection
parent
ba286f337c
commit
f0ef0fbb21
|
@ -91,7 +91,6 @@ namespace Encompass
|
|||
internal void RegisterComponent(Type componentType)
|
||||
{
|
||||
registeredComponentTypes.Add(componentType);
|
||||
AddEngine((Engine)Activator.CreateInstance(typeof(ComponentEmitter<>).MakeGenericType(componentType)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -134,13 +133,10 @@ namespace Encompass
|
|||
|
||||
foreach (var componentType in engine.readTypes.Union(engine.writeTypes))
|
||||
{
|
||||
if (!registeredComponentTypes.Contains(componentType))
|
||||
{
|
||||
RegisterComponent(componentType);
|
||||
}
|
||||
RegisterComponent(componentType);
|
||||
}
|
||||
|
||||
foreach (var receiveType in engine.receiveTypes.Union(engine.readPendingTypes).Union(engine.readTypes))
|
||||
foreach (var receiveType in engine.receiveTypes.Union(engine.readPendingTypes))
|
||||
{
|
||||
if (!typeToReaders.ContainsKey(receiveType))
|
||||
{
|
||||
|
@ -327,6 +323,14 @@ namespace Encompass
|
|||
}
|
||||
|
||||
var engineOrder = new List<Engine>();
|
||||
|
||||
foreach (var registeredComponentType in registeredComponentTypes)
|
||||
{
|
||||
var emitterEngine = (Engine)Activator.CreateInstance(typeof(ComponentEmitter<>).MakeGenericType(registeredComponentType));
|
||||
AddEngine(emitterEngine);
|
||||
engineOrder.Add(emitterEngine);
|
||||
}
|
||||
|
||||
foreach (var engine in engineGraph.TopologicalSort())
|
||||
{
|
||||
engineOrder.Add(engine);
|
||||
|
|
Loading…
Reference in New Issue