public override ObjectModel Disassemble(LineRenderer source, DisassemblyContext context)
        {
            ValueAssembler    assembler      = new ValueAssembler();
            RendererAssembler baseSerializer = new RendererAssembler(); // Base serialization could potentially be automated using reflection.

            return(new ObjectModel(baseSerializer.Disassemble(source, context),
                                   new ObjectField("PositionCount", new PrimitiveModel(source.positionCount)),
                                   new ObjectField("Positions", new ArrayModel(GetPositions(source).Select(x => ValueModelFactory.Create(x, context)))),
                                   new ObjectField("Curve", ValueModelFactory.Create(source.widthCurve, context)),
                                   new ObjectField("Colors", ValueModelFactory.Create(source.colorGradient, context)),
                                   new ObjectField("CornerVerticies", new PrimitiveModel(source.numCornerVertices)),
                                   new ObjectField("CapVerticies", new PrimitiveModel(source.numCapVertices)),
                                   new ObjectField("Alignment", new PrimitiveModel(source.alignment)),
                                   new ObjectField("TextureMode", new PrimitiveModel(source.textureMode)),
                                   new ObjectField("ShadowBias", new PrimitiveModel(source.shadowBias)),
                                   new ObjectField("GenerateLighingData", new PrimitiveModel(source.generateLightingData)),
                                   new ObjectField("UseWorldSpace", new PrimitiveModel(source.useWorldSpace))));
        }
        public override ObjectModel Disassemble(TrailRenderer source, DisassemblyContext context)
        {
            RendererAssembler baseAssembler = new RendererAssembler();

            return(new ObjectModel(baseAssembler.Disassemble(source, context),
                                   new ObjectField("Curve", ValueModelFactory.Create(source.widthCurve, context)),
                                   new ObjectField("Time", new PrimitiveModel(source.time)),
                                   new ObjectField("MinVertexDistance", new PrimitiveModel(source.minVertexDistance)),
                                   new ObjectField("Autodestruct", new PrimitiveModel(source.autodestruct)),
                                   new ObjectField("Emitting", new PrimitiveModel(source.emitting)),
                                   new ObjectField("Color", ValueModelFactory.Create(source.colorGradient, context)),
                                   new ObjectField("CornerVertices", new PrimitiveModel(source.numCornerVertices)),
                                   new ObjectField("CapVertices", new PrimitiveModel(source.numCapVertices)),
                                   new ObjectField("Alignment", new PrimitiveModel(source.alignment)),
                                   new ObjectField("TextureMode", new PrimitiveModel(source.textureMode)),
                                   new ObjectField("GenerateLigtingData", new PrimitiveModel(source.generateLightingData)),
                                   new ObjectField("ShadowBias", new PrimitiveModel(source.shadowBias))
                                   ));
        }
        public override void Assemble(ObjectModel model, TrailRenderer target, AssemblyContext context)
        {
            ValueAssembler    assembler     = new ValueAssembler();
            RendererAssembler baseAssembler = new RendererAssembler();

            target.widthCurve           = (AnimationCurve)assembler.Assemble(model.GetProperty("Curve"), typeof(AnimationCurve), context);
            target.time                 = model.GetValue <float>("Time");
            target.minVertexDistance    = model.GetValue <float>("MinVertexDistance");
            target.autodestruct         = model.GetValue <bool>("Autodestruct");
            target.emitting             = model.GetValue <bool>("Emitting");
            target.colorGradient        = (Gradient)assembler.Assemble(model.GetProperty("Color"), typeof(Gradient), context);
            target.numCornerVertices    = model.GetValue <int>("CornerVertices");
            target.numCapVertices       = model.GetValue <int>("CapVertices");
            target.alignment            = model.GetValue <LineAlignment>("Alignment");
            target.textureMode          = model.GetValue <LineTextureMode>("TextureMode");
            target.generateLightingData = model.GetValue <bool>("GenerateLigtingData");
            target.shadowBias           = model.GetValue <float>("ShadowBias");

            baseAssembler.Assemble(model, target, context);
        }
        public override void Assemble(ObjectModel model, LineRenderer target, AssemblyContext context)
        {
            ValueAssembler    assembler      = new ValueAssembler();
            RendererAssembler baseSerializer = new RendererAssembler();

            target.positionCount = model.GetValue <int>("PositionCount");
            SetPositions(target, model.GetArray("Positions").Select(x => (Vector3)assembler.Assemble(x, typeof(Vector3), context)).ToArray());
            target.widthCurve    = (AnimationCurve)assembler.Assemble(model.GetProperty("Curve"), typeof(AnimationCurve), context);
            target.colorGradient = (Gradient)assembler.Assemble(model.GetProperty("Colors"), typeof(Gradient), context);

            target.numCornerVertices    = model.GetValue <int>("CornerVerticies");
            target.numCapVertices       = model.GetValue <int>("CapVerticies");
            target.alignment            = model.GetValue <LineAlignment>("Alignment");
            target.textureMode          = model.GetValue <LineTextureMode>("TextureMode");
            target.shadowBias           = model.GetValue <float>("ShadowBias");
            target.generateLightingData = model.GetValue <bool>("GenerateLighingData");
            target.useWorldSpace        = model.GetValue <bool>("UseWorldSpace");

            baseSerializer.Assemble(model, target, context);
        }