Exemplo n.º 1
0
 private void Evaluate(Playable playable, FrameData frameData)
 {
     if (this.m_IntervalTree != null)
     {
         double time = PlayableExtensions.GetTime <Playable>(playable);
         this.m_ActiveBit = ((this.m_ActiveBit != 0) ? 0 : 1);
         this.m_CurrentListOfActiveClips.Clear();
         this.m_IntervalTree.IntersectsWith(DiscreteTime.GetNearestTick(time), this.m_ActiveBit, ref this.m_CurrentListOfActiveClips);
         for (int i = 0; i < this.m_ActiveClips.Count; i++)
         {
             RuntimeElement runtimeElement = this.m_ActiveClips[i];
             if (runtimeElement.intervalBit != this.m_ActiveBit)
             {
                 runtimeElement.enable = false;
             }
         }
         for (int j = 0; j < this.m_CurrentListOfActiveClips.Count; j++)
         {
             this.m_CurrentListOfActiveClips[j].EvaluateAt(time, frameData);
         }
         this.m_ActiveClips.Clear();
         this.m_ActiveClips.AddRange(this.m_CurrentListOfActiveClips);
         int count = this.m_EvaluateCallbacks.Count;
         for (int k = 0; k < count; k++)
         {
             this.m_EvaluateCallbacks[k].Evaluate();
         }
     }
 }
Exemplo n.º 2
0
        private void Evaluate(Playable playable, FrameData frameData)
        {
            if (m_IntervalTree == null)
            {
                return;
            }

            double localTime = playable.GetTime();

            m_ActiveBit = m_ActiveBit == 0 ? 1 : 0;

            m_CurrentListOfActiveClips.Clear();
            m_IntervalTree.IntersectsWith(DiscreteTime.GetNearestTick(localTime), m_CurrentListOfActiveClips);

            foreach (var c in m_CurrentListOfActiveClips)
            {
                c.intervalBit = m_ActiveBit;
                if (frameData.timeLooped)
                {
                    c.Reset();
                }
            }

            // all previously active clips having a different intervalBit flag are not
            // in the current intersection, therefore are considered becoming disabled at this frame
            var timelineEnd = playable.GetDuration();

            foreach (var c in m_ActiveClips)
            {
                if (c.intervalBit != m_ActiveBit)
                {
                    var clipEnd = (double)DiscreteTime.FromTicks(c.intervalEnd);
                    var time    = frameData.timeLooped ? Math.Min(clipEnd, timelineEnd) : Math.Min(localTime, clipEnd);
                    c.EvaluateAt(time, frameData);
                    c.enable = false;
                }
            }

            m_ActiveClips.Clear();
            // case 998642 - don't use m_ActiveClips.AddRange, as in 4.6 .Net scripting it causes GC allocs
            for (var a = 0; a < m_CurrentListOfActiveClips.Count; a++)
            {
                m_CurrentListOfActiveClips[a].EvaluateAt(localTime, frameData);
                m_ActiveClips.Add(m_CurrentListOfActiveClips[a]);
            }

            int count = m_EvaluateCallbacks.Count;

            for (int i = 0; i < count; i++)
            {
                m_EvaluateCallbacks[i].Evaluate();
            }
        }
Exemplo n.º 3
0
        private void Evaluate(Playable playable, FrameData frameData)
        {
            if (m_IntervalTree == null)
            {
                return;
            }

            double localTime = playable.GetTime();

            m_ActiveBit = m_ActiveBit == 0 ? 1 : 0;

            m_CurrentListOfActiveClips.Clear();
            m_IntervalTree.IntersectsWith(DiscreteTime.GetNearestTick(localTime), m_CurrentListOfActiveClips);

            foreach (var c in m_CurrentListOfActiveClips)
            {
                c.intervalBit = m_ActiveBit;
            }


            // all previously active clips having a different intervalBit flag are not
            // in the current intersection, therefore are considered becoming disabled at this frame
            for (int a = 0; a < m_ActiveClips.Count; a++)
            {
                var c = m_ActiveClips[a];
                if (c.intervalBit != m_ActiveBit)
                {
                    // Set time to the latest timeline time before disabling the clip.
                    c.EvaluateAt(localTime, frameData);
                    c.enable = false;
                }
            }

            m_ActiveClips.Clear();
            // case 998642 - don't use m_ActiveClips.AddRange, as in 4.6 .Net scripting it causes GC allocs
            for (int a = 0; a < m_CurrentListOfActiveClips.Count; a++)
            {
                m_CurrentListOfActiveClips[a].EvaluateAt(localTime, frameData);
                m_ActiveClips.Add(m_CurrentListOfActiveClips[a]);
            }

            int count = m_EvaluateCallbacks.Count;

            for (int i = 0; i < count; i++)
            {
                m_EvaluateCallbacks[i].Evaluate();
            }
        }
        private bool CanTriggerEvent(double playableTime, FrameData info)
        {
            bool flag = DiscreteTime.GetNearestTick(playableTime) >= DiscreteTime.GetNearestTick(this.triggerTime);
            bool result;

            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = this.HasLooped(playableTime, info) && this.triggerTime >= this.m_PreviousTime && this.triggerTime <= this.m_PreviousTime + (double)info.get_deltaTime();
                result = flag2;
            }
            return(result);
        }
 private bool CanRestoreEvent(double playableTime, FrameData info)
 {
     return(DiscreteTime.GetNearestTick(playableTime) < DiscreteTime.GetNearestTick(this.triggerTime));
 }