Exemplo n.º 1
0
 internal void AddEvent(FlythroughEvent <Camera> evt)
 {
     mEvents.AddEvent(evt);
     if (mEvents.Count == 1)
     {
         evt.StartValue = Start;
     }
 }
Exemplo n.º 2
0
        public void AddEvent(FlythroughEvent <Rotation> evt)
        {
            mOrientationSequence.AddEvent(evt);
            if (evt is IPositionListener)
            {
                ((IPositionListener)evt).Init(mPositionSequence);
            }

            evt.LengthChange += new EventHandler <LengthChangeEventArgs <Rotation> >(orientationEvt_LengthChange);
        }
Exemplo n.º 3
0
        public void AddEvent(FlythroughEvent <Vector3> evt)
        {
            mPositionSequence.AddEvent(evt);
            if (evt is IOrientationListener)
            {
                ((IOrientationListener)evt).Init(mOrientationSequence);
            }

            evt.LengthChange += new EventHandler <LengthChangeEventArgs <Vector3> >(posEvt_LengthChange);
        }
Exemplo n.º 4
0
        /// <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();
            }
        }