public virtual void GenerateCode(LdtkJson ldtkJson, LdtkGeneratorContext ctx, CodeOutput output) { List <CompilationUnitFragment> fragments = new List <CompilationUnitFragment>(); foreach (EnumDefinition ed in ldtkJson.Defs.Enums) { fragments.Add(GenerateEnum(ed, ctx)); } foreach (EntityDefinition ed in ldtkJson.Defs.Entities) { CompilationUnitClass entity = GenerateEntity(ed, ctx); fragments.Add(entity); if (ctx.CodeCustomizer != null) { ctx.CodeCustomizer.CustomizeEntity(entity, ed, ctx); } } CompilationUnitClass level = GenerateLevel(ldtkJson, ctx); fragments.Add(level); if (ctx.CodeCustomizer != null) { ctx.CodeCustomizer.CustomizeLevel(level, ldtkJson, ctx); } output.OutputCode(fragments, ctx); }