コード例 #1
0
        static void AddComponentSystemPatchesForMatchingTypes(bool editorWorld, IEnumerable <Type> allTypes, World world)
        {
            var systemTypes = allTypes.Where(t =>
                                             t.IsSubclassOf(typeof(ComponentSystemBase)) &&
                                             !t.IsAbstract &&
                                             !t.ContainsGenericParameters &&
                                             t.GetCustomAttributes(typeof(ComponentSystemPatchAttribute), true).Length > 0 &&
                                             t.GetCustomAttributes(typeof(DisableAutoCreationAttribute), true).Length == 0);

            foreach (var type in systemTypes)
            {
                if (editorWorld && type.GetCustomAttributes(typeof(ExecuteInEditMode), true).Length == 0)
                {
                    continue;
                }

                world.AddComponentSystemPatch(type);
            }
        }