Ejemplo n.º 1
0
        /// <summary>
        /// The cutscene has been set to an arbitrary time by the user.
        /// Processing must take place to catch up to the new time.
        /// </summary>
        /// <param name="time">The new cutscene running time</param>
        public virtual void SetTime(float time)
        {
            float previousTime = elapsedTime;

            elapsedTime = time;

            foreach (TimelineItem item in GetTimelineItems())
            {
                // Check if it is a global event.
                CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                if (cinemaEvent != null)
                {
                    if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                    {
                        cinemaEvent.Trigger();
                    }
                    else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                    {
                        cinemaEvent.Reverse();
                    }
                }

                // Check if it is a global action.
                CinemaGlobalAction action = item as CinemaGlobalAction;
                if (action != null)
                {
                    action.SetTime((time - action.Firetime), time - previousTime);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The cutscene has been set to an arbitrary time by the user.
        /// Processing must take place to catch up to the new time.
        /// </summary>
        /// <param name="time">The new cutscene running time</param>
        public virtual void SetTime(float time)
        {
            float previousTime = elapsedTime;

            elapsedTime = time;

            TimelineItem[] timelineItemArr = GetTimelineItems();
            for (int i = 0; i < timelineItemArr.Length; i++)
            {
                TimelineItem item = timelineItemArr[i];
                // Check if it is a global event.
                CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                if (cinemaEvent != null)
                {
                    if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                    {
                        cinemaEvent.Trigger();
                    }
                    else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                    {
                        cinemaEvent.Reverse();
                    }
                }

                // Check if it is a global action.
                CinemaGlobalAction action = item as CinemaGlobalAction;
                if (action != null)
                {
                    action.SetTime((time - action.Firetime), time - previousTime);
                }
            }
        }
        /// <summary>
        /// The cutscene has been set to an arbitrary time by the user.
        /// Processing must take place to catch up to the new time.
        /// </summary>
        /// <param name="time">The new cutscene running time</param>
        public virtual void SetTime(float time)
        {
            float previousTime = elapsedTime;

            elapsedTime = time;

            TimelineItem[] items = GetTimelineItems();
            for (int i = 0; i < items.Length; i++)
            {
                // Check if it is a global event.
                CinemaGlobalEvent cinemaEvent = items[i] as CinemaGlobalEvent;
                if (cinemaEvent != null)
                {
                    if ((previousTime < cinemaEvent.Firetime && time >= cinemaEvent.Firetime) || (cinemaEvent.Firetime == 0f && previousTime <= cinemaEvent.Firetime && time > cinemaEvent.Firetime))
                    {
                        cinemaEvent.Trigger();
                    }
                    else if (previousTime > cinemaEvent.Firetime && elapsedTime <= cinemaEvent.Firetime)
                    {
                        cinemaEvent.Reverse();
                    }
                }

                // Check if it is a global action.
                CinemaGlobalAction action = items[i] as CinemaGlobalAction;
                if (action != null)
                {
                    action.SetTime((time - action.Firetime), time - previousTime);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update the track to the given time
        /// </summary>
        /// <param name="time"></param>
        public virtual void UpdateTrack(float runningTime, float deltaTime)
        {
            if (mute)
            {
                return;
            }
            float previousTime = elapsedTime;

            elapsedTime = runningTime;

            TimelineItem[] items = GetTimelineItems();
            for (int i = 0; i < items.Length; i++)
            {
                CinemaGlobalEvent cinemaEvent = items[i] as CinemaGlobalEvent;
                if (cinemaEvent == null)
                {
                    continue;
                }

                if ((previousTime < cinemaEvent.Firetime || previousTime <= 0f) && elapsedTime >= cinemaEvent.Firetime)
                {
                    cinemaEvent.Trigger();
                }
                else if (previousTime >= cinemaEvent.Firetime && elapsedTime <= cinemaEvent.Firetime)
                {
                    cinemaEvent.Reverse();
                }
            }

            for (int i = 0; i < items.Length; i++)
            {
                CinemaGlobalAction action = items[i] as CinemaGlobalAction;
                if (action == null)
                {
                    continue;
                }
                if (((previousTime < action.Firetime || previousTime <= 0f) && elapsedTime >= action.Firetime) && elapsedTime < action.EndTime)
                {
                    action.Trigger();
                }
                else if ((previousTime <= action.EndTime) && (elapsedTime >= action.EndTime))
                {
                    action.End();
                }
                else if (previousTime > action.Firetime && previousTime <= action.EndTime && elapsedTime <= action.Firetime)
                {
                    action.ReverseTrigger();
                }
                else if ((previousTime > action.EndTime || previousTime >= action.Cutscene.Duration) && (elapsedTime > action.Firetime) && (elapsedTime <= action.EndTime))
                {
                    action.ReverseEnd();
                }
                else if ((elapsedTime > action.Firetime) && (elapsedTime < action.EndTime))
                {
                    float t = runningTime - action.Firetime;
                    action.UpdateTime(t, deltaTime);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Update the track to the given time
        /// </summary>
        /// <param name="time"></param>
        public virtual void UpdateTrack(float runningTime, float deltaTime)
        {
            float previousTime = elapsedTime;

            elapsedTime = runningTime;

            TimelineItem[] timelineItemArr = GetTimelineItems();
            for (int i = 0; i < timelineItemArr.Length; i++)
            {
                TimelineItem      item        = timelineItemArr[i];
                CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                if (cinemaEvent == null)
                {
                    continue;
                }

                if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                {
                    cinemaEvent.Trigger();
                }
                else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                {
                    cinemaEvent.Reverse();
                }
            }

            for (int i = 0; i < timelineItemArr.Length; i++)
            {
                TimelineItem       item   = timelineItemArr[i];
                CinemaGlobalAction action = item as CinemaGlobalAction;
                if (action == null)
                {
                    continue;
                }
                if ((previousTime < action.Firetime && elapsedTime >= action.Firetime) && elapsedTime < action.EndTime)
                {
                    action.Trigger();
                }
                else if ((previousTime < action.EndTime) && (elapsedTime >= action.EndTime))
                {
                    action.End();
                }
                else if (previousTime > action.Firetime && previousTime <= action.EndTime && elapsedTime < action.Firetime)
                {
                    action.ReverseTrigger();
                }
                else if ((previousTime > (action.EndTime) && (elapsedTime > action.Firetime) && (elapsedTime <= action.EndTime)))
                {
                    action.ReverseEnd();
                }
                else if ((elapsedTime > action.Firetime) && (elapsedTime < action.EndTime))
                {
                    float t = runningTime - action.Firetime;
                    action.UpdateTime(t, deltaTime);
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Update the track to the given time
        /// </summary>
        /// <param name="time"></param>
        public virtual void UpdateTrack(float runningTime, float deltaTime)
        {
            float previousTime = elapsedTime;

            elapsedTime = runningTime;

            List <TimelineItem> items = GetAllTimelineItems();

            for (int i = 0; i < items.Count; i++)
            {
                CinemaGlobalEvent cinemaEvent = items[i] as CinemaGlobalEvent;
                if (cinemaEvent == null)
                {
                    continue;
                }

                if ((previousTime < cinemaEvent.Firetime || previousTime <= 0f) && elapsedTime >= cinemaEvent.Firetime)
                {
                    cinemaEvent.Trigger();
                }
                else if (previousTime >= cinemaEvent.Firetime && elapsedTime <= cinemaEvent.Firetime)
                {
                    cinemaEvent.Reverse();
                }
            }

            for (int i = 0; i < items.Count; i++)
            {
                CinemaGlobalAction action = items[i] as CinemaGlobalAction;
                if (action == null)
                {
                    continue;
                }
                var actionScene = action.GetCutScene();
                if (((previousTime < action.Firetime || previousTime <= 0f) && elapsedTime >= action.Firetime) && elapsedTime < action.EndTime)
                {
                    action.Trigger();
                }
                else if ((previousTime <= action.EndTime) && (elapsedTime >= action.EndTime))
                {
                    action.End();
                }
                else if (previousTime > action.Firetime && previousTime <= action.EndTime && elapsedTime <= action.Firetime)
                {
                    action.ReverseTrigger();
                }
                else if ((previousTime > action.EndTime || (actionScene != null && previousTime >= actionScene.Duration)) && (elapsedTime > action.Firetime) && (elapsedTime <= action.EndTime))
                {
                    action.ReverseEnd();
                }
                else if ((elapsedTime > action.Firetime) && (elapsedTime < action.EndTime))
                {
                    float t = runningTime - action.Firetime;
                    action.UpdateTime(t, deltaTime);
                }
            }
        }
 static public int Trigger(IntPtr l)
 {
     try {
         CinemaDirector.CinemaGlobalEvent self = (CinemaDirector.CinemaGlobalEvent)checkSelf(l);
         self.Trigger();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// The cutscene has been set to an arbitrary time by the user.
        /// Processing must take place to catch up to the new time.
        /// </summary>
        /// <param name="time">The new cutscene running time</param>
        public virtual void SetTime(float time)
        {
#if PROFILE_FILE
            Profiler.BeginSample("TimelineTrack.SetTime");
#endif // PROFILE_FILE
            float previousTime = elapsedTime;
            elapsedTime = time;

            var timeLines = GetTimelineItems();
            var length    = timeLines.Length;
            for (var i = 0; i < length; i++)
            {
                var item = timeLines[i];
                // Check if it is a global event.
                CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                if (cinemaEvent != null)
                {
                    if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                    {
                        cinemaEvent.Trigger();
                    }
                    else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                    {
                        cinemaEvent.Reverse();
                    }
                }

                // Check if it is a global action.
                CinemaGlobalAction action = item as CinemaGlobalAction;
                if (action != null)
                {
                    action.SetTime((time - action.Firetime), time - previousTime);
                }
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The cutscene has been set to an arbitrary time by the user.
        /// Processing must take place to catch up to the new time.
        /// </summary>
        /// <param name="time">The new cutscene running time</param>
        public virtual void SetTime(float time)
        {
            float previousTime = elapsedTime;

            elapsedTime = time;
            {
                var __array5       = GetTimelineItems();
                var __arrayLength5 = __array5.Length;
                for (int __i5 = 0; __i5 < __arrayLength5; ++__i5)
                {
                    var item = (TimelineItem)__array5[__i5];
                    {
                        // Check if it is a global event.
                        CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                        if (cinemaEvent != null)
                        {
                            if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                            {
                                cinemaEvent.Trigger();
                            }
                            else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                            {
                                cinemaEvent.Reverse();
                            }
                        }

                        // Check if it is a global action.
                        CinemaGlobalAction action = item as CinemaGlobalAction;
                        if (action != null)
                        {
                            action.SetTime((time - action.Firetime), time - previousTime);
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Update the track to the given time
        /// </summary>
        /// <param name="time"></param>
        public virtual void UpdateTrack(float runningTime, float deltaTime)
        {
            float previousTime = elapsedTime;

            elapsedTime = runningTime;
            {
                var __array3       = GetTimelineItems();
                var __arrayLength3 = __array3.Length;
                for (int __i3 = 0; __i3 < __arrayLength3; ++__i3)
                {
                    var item = (TimelineItem)__array3[__i3];
                    {
                        CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                        if (cinemaEvent == null)
                        {
                            continue;
                        }

                        if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                        {
                            cinemaEvent.Trigger();
                        }
                        else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                        {
                            cinemaEvent.Reverse();
                        }
                    }
                }
            }
            {
                var __array4       = GetTimelineItems();
                var __arrayLength4 = __array4.Length;
                for (int __i4 = 0; __i4 < __arrayLength4; ++__i4)
                {
                    var item = (TimelineItem)__array4[__i4];
                    {
                        CinemaGlobalAction action = item as CinemaGlobalAction;
                        if (action == null)
                        {
                            continue;
                        }
                        if ((previousTime < action.Firetime && elapsedTime >= action.Firetime) && elapsedTime < action.EndTime)
                        {
                            action.Trigger();
                        }
                        else if ((previousTime < action.EndTime) && (elapsedTime >= action.EndTime))
                        {
                            action.End();
                        }
                        else if (previousTime > action.Firetime && previousTime <= action.EndTime && elapsedTime < action.Firetime)
                        {
                            action.ReverseTrigger();
                        }
                        else if ((previousTime > (action.EndTime) && (elapsedTime > action.Firetime) && (elapsedTime <= action.EndTime)))
                        {
                            action.ReverseEnd();
                        }
                        else if ((elapsedTime > action.Firetime) && (elapsedTime < action.EndTime))
                        {
                            float t = runningTime - action.Firetime;
                            action.UpdateTime(t, deltaTime);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Update the track to the given time
        /// </summary>
        /// <param name="time"></param>
        public virtual void UpdateTrack(float runningTime, float deltaTime)
        {
#if PROFILE_FILE
            Profiler.BeginSample("TimelineTrack.UpdateTrack");
#endif // PROFILE_FILE
            float previousTime = elapsedTime;
            elapsedTime = runningTime;

#if PROFILE_FILE
            Profiler.BeginSample("TimelineTrack.UpdateTrack.seg_1");
#endif // PROFILE_FILE
            var timeLines = GetTimelineItems();
            var length    = timeLines.Length;
            for (var i = 0; i < length; i++)
            {
                var item = timeLines[i];
                CinemaGlobalEvent cinemaEvent = item as CinemaGlobalEvent;
                if (cinemaEvent == null)
                {
                    continue;
                }

                if ((previousTime < cinemaEvent.Firetime) && (((elapsedTime >= cinemaEvent.Firetime))))
                {
                    cinemaEvent.Trigger();
                }
                else if (((previousTime >= cinemaEvent.Firetime) && (elapsedTime < cinemaEvent.Firetime)))
                {
                    cinemaEvent.Reverse();
                }
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE


#if PROFILE_FILE
            Profiler.BeginSample("TimelineTrack.UpdateTrack.seg_2");
#endif // PROFILE_FILE
            timeLines = GetTimelineItems();
            length    = timeLines.Length;
            for (var i = 0; i < length; i++)
            {
                var item = timeLines[i];
                CinemaGlobalAction action = item as CinemaGlobalAction;
                if (action == null)
                {
                    continue;
                }
                if ((previousTime < action.Firetime && elapsedTime >= action.Firetime) && elapsedTime < action.EndTime)
                {
                    action.Trigger();
                }
                else if ((previousTime < action.EndTime) && (elapsedTime >= action.EndTime))
                {
                    action.End();
                }
                else if (previousTime > action.Firetime && previousTime <= action.EndTime && elapsedTime < action.Firetime)
                {
                    action.ReverseTrigger();
                }
                else if ((previousTime > (action.EndTime) && (elapsedTime > action.Firetime) && (elapsedTime <= action.EndTime)))
                {
                    action.ReverseEnd();
                }
                else if ((elapsedTime > action.Firetime) && (elapsedTime < action.EndTime))
                {
                    float t = runningTime - action.Firetime;
                    action.UpdateTime(t, deltaTime);
                }
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE

#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }