public static void Start()
{
// Attach an EgoComponent Component to each GameObject
var gameObjects = Object.FindObjectsOfType <GameObject>();
var egoComponents = new List <EgoComponent>();
foreach (var gameObject in gameObjects)
{
var egoComponent = gameObject.GetComponent <EgoComponent>();
if (!egoComponent)
{
egoComponent = gameObject.AddComponent <EgoComponent>();
}
egoComponent.CreateMask();
egoComponents.Add(egoComponent);
}
// Create System bundles
foreach (var system in _systems)
{
system.CreateBundles(egoComponents.ToArray());
}
// Start all Systems
foreach (var system in _systems)
{
system.Start();
}
// Invoke all queued Events
EgoEvents.Invoke();
// Clean up Destroyed Components & GameObjects
EgoCleanUp.CleanUp();
}