示例#1
0
        internal EcsService(IEnumerable <Type> availableTemplates)
        {
            // processing templates
            foreach (Type availableTemplateType in availableTemplates)
            {
                EntityTemplate template = null;
                try
                {
                    template = (EntityTemplate)Activator.CreateInstance(availableTemplateType);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, $"Unable to create template '{availableTemplateType.Name}'");
                    continue;
                }

                template.Initialize();

                _templates[availableTemplateType] = template;
                _templatesByName[template.Name]   = template;
            }
        }