Пример #1
0
        public static dynamic TryGetPathProperty(Track track, string propertyName, float time)
        {
            Property pathProperty = null;

            track?.PathProperties.TryGetValue(propertyName, out pathProperty);
            if (pathProperty == null)
            {
                return(null);
            }

            PointDefinitionInterpolation pointDataInterpolation = (PointDefinitionInterpolation)pathProperty.Value;

            switch (pathProperty.PropertyType)
            {
            case PropertyType.Linear:
                return(pointDataInterpolation.InterpolateLinear(time));

            case PropertyType.Quaternion:
                return(pointDataInterpolation.InterpolateQuaternion(time));

            case PropertyType.Vector3:
                return(pointDataInterpolation.Interpolate(time));

            case PropertyType.Vector4:
                return(pointDataInterpolation.InterpolateVector4(time));

            default:
                return(null);
            }
        }
        public static Vector4?TryGetVector4PathProperty(Track track, string propertyName, float time)
        {
            PointDefinitionInterpolation pointDataInterpolation = GetPathInterpolation(track, propertyName, PropertyType.Vector4);

            if (pointDataInterpolation != null)
            {
                return(pointDataInterpolation.InterpolateVector4(time));
            }

            return(null);
        }