/// <summary> /// Import XML data into this camera path overwriting the current data /// </summary> /// <param name="XMLPath">An XML file path</param> public void FromXML(XmlNode xml) { if (xml == null) { return; } GameObject animationObjectGO = GameObject.Find(xml["animationObject"].FirstChild.Value); if (animationObjectGO != null) { animationObject = animationObjectGO.transform; } GameObject orientationTargetGO = GameObject.Find(xml["orientationTarget"].FirstChild.Value); if (orientationTargetGO != null) { orientationTarget = orientationTargetGO.transform; } _animateSceneObjectInEditor = bool.Parse(xml["animateSceneObjectInEditor"].FirstChild.Value); playOnStart = bool.Parse(xml["playOnStart"].FirstChild.Value); animationMode = (animationModes)Enum.Parse(typeof(animationModes), xml["animationMode"].FirstChild.Value); orientationMode = (orientationModes)Enum.Parse(typeof(orientationModes), xml["orientationMode"].FirstChild.Value); normalised = bool.Parse(xml["normalised"].FirstChild.Value); _pathSpeed = float.Parse(xml["pathSpeed"].FirstChild.Value); }
/// <summary> /// Reverse the animation /// </summary> public void Reverse() { switch (animationMode) { case animationModes.once: animationMode = animationModes.reverse; break; case animationModes.reverse: animationMode = animationModes.once; break; case animationModes.pingPong: pingPongDirection = pingPongDirection == -1 ? 1 : -1; break; case animationModes.loop: animationMode = animationModes.reverseLoop; break; case animationModes.reverseLoop: animationMode = animationModes.loop; break; } }
/// <summary> /// Import XML data into this camera path overwriting the current data /// </summary> /// <param name="XMLPath">An XML file path</param> public void FromXML(XmlNode xml) { if(xml == null) return; GameObject animationObjectGO = GameObject.Find(xml["animationObject"].FirstChild.Value); if(animationObjectGO != null) animationObject = animationObjectGO.transform; GameObject orientationTargetGO = GameObject.Find(xml["orientationTarget"].FirstChild.Value); if (orientationTargetGO != null) orientationTarget = orientationTargetGO.transform; _animateSceneObjectInEditor = bool.Parse(xml["animateSceneObjectInEditor"].FirstChild.Value); playOnStart = bool.Parse(xml["playOnStart"].FirstChild.Value); animationMode = (animationModes)Enum.Parse(typeof(animationModes), xml["animationMode"].FirstChild.Value); orientationMode = (orientationModes)Enum.Parse(typeof(orientationModes), xml["orientationMode"].FirstChild.Value); normalised = bool.Parse(xml["normalised"].FirstChild.Value); _pathSpeed = float.Parse(xml["pathSpeed"].FirstChild.Value); }
/// <summary> /// Reverse the animation /// </summary> public void Reverse() { switch (animationMode) { case animationModes.once: animationMode = animationModes.reverse; break; case animationModes.reverse: animationMode = animationModes.once; break; case animationModes.pingPong: pingPongDirection = pingPongDirection == -1 ? 1 : -1; break; case animationModes.loop: animationMode = animationModes.reverseLoop; break; case animationModes.reverseLoop: animationMode = animationModes.loop; break; } }
/// <summary> /// Import XML data into this camera path overwriting the current data /// </summary> /// <param name="XMLPath">An XML file path</param> public void FromXML(XmlNode xml) { if (xml == null) { return; } GameObject animationObjectGO = GameObject.Find(xml["animationObject"].FirstChild.Value); if (animationObjectGO != null) { animationObject = animationObjectGO.transform; } GameObject orientationTargetGO = GameObject.Find(xml["orientationTarget"].FirstChild.Value); if (orientationTargetGO != null) { orientationTarget = orientationTargetGO.transform; } _animateSceneObjectInEditor = bool.Parse(xml["animateSceneObjectInEditor"].FirstChild.Value); playOnStart = bool.Parse(xml["playOnStart"].FirstChild.Value); animationMode = (animationModes)Enum.Parse(typeof(animationModes), xml["animationMode"].FirstChild.Value); _orientationMode = (orientationModes)Enum.Parse(typeof(orientationModes), xml["orientationMode"].FirstChild.Value); normalised = bool.Parse(xml["normalised"].FirstChild.Value); _pathSpeed = float.Parse(xml["pathSpeed"].FirstChild.Value); if (xml["smoothOrientationModeChanges"] != null) { smoothOrientationModeChanges = bool.Parse(xml["smoothOrientationModeChanges"].FirstChild.Value); } if (xml["orientationModeLerpTime"] != null) { orientationModeLerpTime = float.Parse(xml["orientationModeLerpTime"].FirstChild.Value); } if (xml["fixedOrientaionx"] != null) { Vector3 newOrientation = new Vector3(); newOrientation.x = float.Parse(xml["fixedOrientaionx"].FirstChild.Value); newOrientation.y = float.Parse(xml["fixedOrientaiony"].FirstChild.Value); newOrientation.z = float.Parse(xml["fixedOrientaionz"].FirstChild.Value); fixedOrientaion = newOrientation; } if (xml["fixedPositionx"] != null) { Vector3 newPosition = new Vector3(); newPosition.x = float.Parse(xml["fixedPositionx"].FirstChild.Value); newPosition.y = float.Parse(xml["fixedPositiony"].FirstChild.Value); newPosition.z = float.Parse(xml["fixedPositionz"].FirstChild.Value); fixedPosition = newPosition; } if (xml["sensitivity"] != null) { sensitivity = float.Parse(xml["sensitivity"].FirstChild.Value); } if (xml["minX"] != null) { minX = float.Parse(xml["minX"].FirstChild.Value); } if (xml["maxX"] != null) { maxX = float.Parse(xml["maxX"].FirstChild.Value); } }