예제 #1
0
        public static JSONNode SerializePoseMorphMutation(PoseMutation mutationComponent)
        {
            var newJson = new JSONClass();

            newJson.Add("Name", new JSONData(mutationComponent.Id));
            newJson.Add("Rotation", SerializeQuaternion(mutationComponent.Rotation));
            newJson.Add("Position", SerializeVector3(mutationComponent.Position));
            newJson.Add("PositionState", mutationComponent.PositionState.ToString());
            newJson.Add("RotationState", mutationComponent.RotationState.ToString());
            newJson.Add("StartAtTimeRatio", mutationComponent.StartAtTimeRatio.ToString());
            newJson.Add("EndAtTimeRatio", mutationComponent.EndAtTimeRatio.ToString());
            newJson.Add("Active", new JSONData(mutationComponent.Active));
            return(newJson);
        }
예제 #2
0
        public static PoseMutation DeserializeIntoPoseMorphMutation(JSONClass inputObject)
        {
            var keys = inputObject.Keys.ToList();
            var mutationComponent = new PoseMutation()
            {
                Id               = inputObject.Childs.ElementAt(keys.IndexOf("Name")).Value,
                Rotation         = DeserializeQuaternion(inputObject, "Rotation", Quaternion.identity),
                Position         = DeserializeVector3(inputObject, "Position", Vector3.zero),
                PositionState    = DeserializeString(inputObject, "PositionState", FreeControllerV3.PositionState.On.ToString()),
                RotationState    = DeserializeString(inputObject, "RotationState", FreeControllerV3.PositionState.On.ToString()),
                StartAtTimeRatio = float.Parse(DeserializeString(inputObject, "StartAtTimeRatio", "0")),
                EndAtTimeRatio   = float.Parse(DeserializeString(inputObject, "EndAtTimeRatio", "1")),
                Active           = bool.Parse(inputObject["Active"].Value)
            };

            return(mutationComponent);
        }