private void RemoveManagerInteral(ModComponentSystem manager)
        {
            if (!m_BehaviourManagers.Remove(manager))
            {
                throw new ArgumentException("manager does not exist in the world");
            }
            ++Version;

            var type = manager.GetType();

            while (type != typeof(ComponentSystemBase))
            {
                if (m_BehaviourManagerLookup[type] == manager)
                {
                    m_BehaviourManagerLookup.Remove(type);

                    foreach (var otherManager in m_BehaviourManagers)
                    {
                        if (otherManager.GetType().IsSubclassOf(type))
                        {
                            AddTypeLookup(otherManager.GetType(), otherManager);
                        }
                    }
                }

                type = type.BaseType;
            }
        }
        private void AddTypeLookup(Type type, ModComponentSystem manager)
        {
            while (type != typeof(ComponentSystemBase))
            {
                if (!m_BehaviourManagerLookup.ContainsKey(type))
                {
                    m_BehaviourManagerLookup.Add(type, manager);
                }

                type = type.BaseType;
            }
        }
 public void DestroyManager(ModComponentSystem manager)
 {
     RemoveManagerInteral(manager);
     RemoveManagerExtraInternal(manager);
 }
 private void CreateManagerExtraInternal(ModComponentSystem manager, int capacity)
 {
     s_CreateInstance.Invoke(manager, new object[] { World.DefaultGameObjectInjectionWorld, capacity });
 }
 //
 // Extra internal
 //
 private void RemoveManagerExtraInternal(ModComponentSystem manager)
 {
     s_DestroyInstance.Invoke(manager, null);
 }