Пример #1
0
        /// <summary>
        /// The shot track will jump to the given time. Disabling the current shot and enabling the new one.
        /// </summary>
        /// <param name="time">The new running time.</param>
        public override void SetTime(float time)
        {
#if PROFILE_FILE
            Profiler.BeginSample("ShotTrack.SetTime");
#endif // PROFILE_FILE
            CinemaShot previousShot = null;
            CinemaShot newShot      = null;

            // Get the old shot and the new shot

            var list   = this.GetTimelineItems();
            var length = list.Length;
            for (var i = 0; i < length; i++)
            {
                var   shot    = list[i] as CinemaShot;
                float endTime = shot.CutTime + shot.Duration;
                if ((elapsedTime >= shot.CutTime) && (elapsedTime < endTime))
                {
                    previousShot = shot;
                }
                if ((time >= shot.CutTime) && (time < endTime))
                {
                    newShot = shot;
                }
            }

            // Trigger them as appropriate.
            if (newShot != previousShot)
            {
                if (previousShot != null)
                {
                    previousShot.End();
                    if (ShotEnds != null)
                    {
                        ShotEnds(this, new ShotEventArgs(previousShot));
                    }
                }
                if (newShot != null)
                {
                    newShot.Trigger();
                    if (ShotBegins != null)
                    {
                        ShotBegins(this, new ShotEventArgs(newShot));
                    }
                }
            }

            elapsedTime = time;
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Пример #2
0
        /// <summary>
        /// The shot track will jump to the given time. Disabling the current shot and enabling the new one.
        /// </summary>
        /// <param name="time">The new running time.</param>
        public override void SetTime(float time)
        {
            CinemaShot previousShot = null;
            CinemaShot newShot      = null;

            {
                var __array4       = GetTimelineItems();
                var __arrayLength4 = __array4.Length;
                for (int __i4 = 0; __i4 < __arrayLength4; ++__i4)
                {
                    var shot = (CinemaShot)__array4[__i4];
                    {
                        float endTime = shot.CutTime + shot.Duration;
                        if ((elapsedTime >= shot.CutTime) && (elapsedTime < endTime))
                        {
                            previousShot = shot;
                        }
                        if ((time >= shot.CutTime) && (time < endTime))
                        {
                            newShot = shot;
                        }
                    }
                }
            }
            // Trigger them as appropriate.
            if (newShot != previousShot)
            {
                if (previousShot != null)
                {
                    previousShot.End();
                    if (ShotEnds != null)
                    {
                        ShotEnds(this, new ShotEventArgs(previousShot));
                    }
                }
                if (newShot != null)
                {
                    newShot.Trigger();
                    if (ShotBegins != null)
                    {
                        ShotBegins(this, new ShotEventArgs(newShot));
                    }
                }
            }

            elapsedTime = time;
        }
Пример #3
0
        /// <summary>
        /// The shot track will jump to the given time. Disabling the current shot and enabling the new one.
        /// </summary>
        /// <param name="time">The new running time.</param>
        public override void SetTime(float time)
        {
            CinemaShot previousShot = null;
            CinemaShot newShot      = null;

            // Get the old shot and the new shot
            foreach (CinemaShot shot in GetTimelineItems())
            {
                float endTime = shot.CutTime + shot.Duration;
                if ((elapsedTime >= shot.CutTime) && (elapsedTime < endTime))
                {
                    previousShot = shot;
                }
                if ((time >= shot.CutTime) && (time < endTime))
                {
                    newShot = shot;
                }
            }

            // Trigger them as appropriate.
            if (newShot != previousShot)
            {
                if (previousShot != null)
                {
                    previousShot.End();
                    if (ShotEnds != null)
                    {
                        ShotEnds(this, new ShotEventArgs(previousShot));
                    }
                }
                if (newShot != null)
                {
                    newShot.Trigger();
                    if (ShotBegins != null)
                    {
                        ShotBegins(this, new ShotEventArgs(newShot));
                    }
                }
            }

            elapsedTime = time;
        }