public RootModel Disassemble(TurretAssembly assembly) { DisassemblyContext context = new DisassemblyContext(); List <ObjectField> tiers = new List <ObjectField>(); foreach (Transform tier in assembly.transform) { tiers.Add(new ObjectField(tier.name, DisassembleTier(assembly, Tier.Parse(tier.gameObject.name), context))); } return(new RootModel(new ObjectModel( new ObjectField("Name", ValueModelFactory.Create(assembly.Name, context)), new ObjectField("Description", ValueModelFactory.Create(assembly.Description, context)), new ObjectField("Tiers", new ObjectModel(tiers.ToArray())), new ObjectField("UpgradeMap", _valueAssembler.Disassemble(assembly.UpgradeMap, typeof(UpgradeMap), new DisassemblyContext()) )))); }
public static ValueModel Create(object value, DisassemblyContext context) { ValueAssembler assemblers = new ValueAssembler(); return(assemblers.Disassemble(value, value.GetType(), context)); }