Пример #1
0
        public static CameraPath Load(ConfigNode node)
        {
            CameraPath newPath = new CameraPath();

            newPath.pathName  = node.GetValue("pathName");
            newPath.points    = ParseVectorList(node.GetValue("points"));
            newPath.rotations = ParseQuaternionList(node.GetValue("rotations"));
            newPath.times     = ParseFloatList(node.GetValue("times"));
            newPath.zooms     = ParseFloatList(node.GetValue("zooms"));
            newPath.lerpRate  = float.Parse(node.GetValue("lerpRate"));
            newPath.timeScale = float.Parse(node.GetValue("timeScale"));
            newPath.Refresh();

            return(newPath);
        }
Пример #2
0
		public static CameraPath Load(ConfigNode node)
		{
			CameraPath newPath = new CameraPath();

			newPath.pathName = node.GetValue("pathName");
			newPath.points = ParseVectorList(node.GetValue("points"));
			newPath.rotations = ParseQuaternionList(node.GetValue("rotations"));
			newPath.times = ParseFloatList(node.GetValue("times"));
			newPath.zooms = ParseFloatList(node.GetValue("zooms"));
			newPath.lerpRate = float.Parse(node.GetValue("lerpRate"));
			newPath.timeScale = float.Parse(node.GetValue("timeScale"));
			newPath.Refresh();

			return newPath;
		}
Пример #3
0
        public static CameraPath Load(ConfigNode node)
        {
            CameraPath newPath = new CameraPath();

            if (node.HasValue("pathName"))
            {
                newPath.pathName = node.GetValue("pathName");
            }
            if (node.HasValue("points"))
            {
                newPath.points = ParseVectorList(node.GetValue("points"));
            }
            if (node.HasValue("positionInterpolationTypes"))
            {
                newPath.positionInterpolationTypes = ParseEnumTypeList <PositionInterpolationType>(node.GetValue("positionInterpolationTypes"));
            }
            if (node.HasValue("rotations"))
            {
                newPath.rotations = ParseQuaternionList(node.GetValue("rotations"));
            }
            if (node.HasValue("rotationInterpolationTypes"))
            {
                newPath.rotationInterpolationTypes = ParseEnumTypeList <RotationInterpolationType>(node.GetValue("rotationInterpolationTypes"));
            }
            if (node.HasValue("times"))
            {
                newPath.times = ParseFloatList(node.GetValue("times"));
            }
            if (node.HasValue("zooms"))
            {
                newPath.zooms = ParseFloatList(node.GetValue("zooms"));
            }
            if (node.HasValue("secondarySmoothing"))
            {
                newPath.secondarySmoothing = float.Parse(node.GetValue("secondarySmoothing"));
            }
            else
            {
                newPath.secondarySmoothing = 0;
            }
            if (node.HasValue("timeScale"))
            {
                newPath.timeScale = float.Parse(node.GetValue("timeScale"));
            }
            else
            {
                newPath.timeScale = 1;
            }

            if (node.HasValue("lerpRate") && !node.HasValue("secondarySmoothing"))
            {
                var lerpRate = float.Parse(node.GetValue("lerpRate")); newPath.secondarySmoothing = Mathf.Round(-50f * Mathf.Log10(lerpRate)) / 100f;
            }                                                                                                                                                                                                                            // Deprecated in favour of secondarySmoothing.

            // Ensure there's a consistent number of entries in the path.
            while (newPath.positionInterpolationTypes.Count < newPath.points.Count)
            {
                newPath.positionInterpolationTypes.Add(PositionInterpolationType.CubicSpline);
            }
            while (newPath.rotations.Count < newPath.points.Count)
            {
                newPath.rotations.Add(Quaternion.identity);
            }
            while (newPath.rotationInterpolationTypes.Count < newPath.points.Count)
            {
                newPath.rotationInterpolationTypes.Add(RotationInterpolationType.CubicSpline);
            }
            while (newPath.times.Count < newPath.points.Count)
            {
                newPath.times.Add(newPath.times.Count);
            }
            while (newPath.zooms.Count < newPath.points.Count)
            {
                newPath.zooms.Add(1);
            }
            newPath.Refresh();

            return(newPath);
        }