Exemple #1
0
        public override AnimationCurve AssembleValue(ObjectModel value, AssemblyContext context)
        {
            ArrayModel     array = value.GetProperty <ArrayModel>("Keyframes");
            AnimationCurve curve = new AnimationCurve(array.Select(x => AssembleKeyframe(x as ObjectModel)).ToArray());

            return(curve);
        }
        public void Assemble(ValueModel source, AssemblyContext context)
        {
            ObjectModel model = source as ObjectModel;

            Identifier  = model.GetValue <string>("Identifier");
            IsCompleted = model.GetValue <bool>("IsCompleted");
            CompletedOn = model.GetValue <DateTime>("CompletedOn");
            Progression = model.GetProperty("Progression");
        }
        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);
        }
Exemple #5
0
        public void Populate(object obj, ObjectModel model, AssemblyContext context)
        {
            Type modelType = obj.GetType();
            IEnumerable <IAssignableMemberInfo> fields = GetModelFields(modelType);

            foreach (IAssignableMemberInfo field in fields)
            {
                var property = model.GetProperty(field.Name);
                if (property != null)
                {
                    GetPropertyAssembler(field.AttributeType).Assemble(obj, field, property, field.ValueType, context);
                }
            }

            context.MakeReferencable(obj, model.Guid);
        }