public void MoveUp(ComboEvent evt) { mEvents.MoveUp(evt); if (evt.SequenceStartTime == 0) { evt.StartValue = Start; } }
/// <summary> /// Initialise the flythrough transition an xml file. /// </summary> /// <param name="file">The file to load as a flythrough.</param> public void Load(string file) { if (!File.Exists(file)) { Logger.Warn("Unable to load " + file + ". Ignoring load request."); return; } if (FlythroughLoading != null) { FlythroughLoading(); } mEvents = new EventSequence <Camera>(); mEvents.LengthChange += new Action <EventSequence <Camera>, int>(mEvents_LengthChange); XmlDocument doc = new XmlDocument(); doc.Load(file); int start = 0; XmlNode root = doc.GetElementsByTagName("Events")[0]; XmlAttribute startPositionAttr = root.Attributes["StartPosition"]; XmlAttribute startPitchAttr = root.Attributes["StartPitch"]; XmlAttribute startYawAttr = root.Attributes["StartYaw"]; Vector3 startPos = mCore.Position; double startPitch = mCore.Orientation.Pitch; double startYaw = mCore.Orientation.Yaw; if (startPositionAttr != null) { Vector3.TryParse(startPositionAttr.Value, out startPos); } if (startPitchAttr != null) { double.TryParse(startPitchAttr.Value, out startPitch); } if (startYawAttr != null) { double.TryParse(startYawAttr.Value, out startYaw); } Start = new Camera(startPos, new Rotation(startPitch, startYaw)); foreach (XmlNode node in root.ChildNodes) { if (node is XmlElement) { ComboEvent evt = new ComboEvent(this); evt.Load(node); mEvents.AddEvent(evt); start = evt.SequenceStartTime + evt.Length; } } mCore.Update(Start.Position, Vector3.Zero, Start.Orientation, Rotation.Zero); if (FlythroughLoaded != null) { FlythroughLoaded(); } }
internal void RemoveEvent(ComboEvent evt) { mEvents.RemoveEvent(evt); mEvents[0].StartValue = Start; }