Пример #1
0
        void IDirectableTimePointer.Update(float currentTime, float previousTime)
        {
            //target directable callbacks
            if (currentTime >= target.startTime && currentTime < target.endTime && currentTime > 0 && currentTime < target.root.length)
            {
                var localCurrentTime  = currentTime - target.startTime;
                var localPreviousTime = (previousTime - target.startTime) + (target.startTime - lastTargetStartTime);

                localCurrentTime  = Mathf.Clamp(localCurrentTime, 0, targetLength);
                localPreviousTime = Mathf.Clamp(localPreviousTime, 0, targetLength);

                                #if UNITY_EDITOR
                if (!Application.isPlaying && target is IKeyable && !target.root.isReSampleFrame)
                {
                    if (localCurrentTime == localPreviousTime)
                    {
                        if (Prefs.autoKey && GUIUtility.hotControl == 0)
                        {
                            ((IKeyable)target).TryAutoKey(localCurrentTime);
                        }
                    }
                }
                                #endif

                target.Update(localCurrentTime, localPreviousTime);
                lastTargetStartTime = target.startTime;
            }


            //root updated callback
            target.RootUpdated(currentTime, previousTime);
        }
Пример #2
0
        //...
        void IDirectableTimePointer.Update(float currentTime, float previousTime)
        {
            //update target and try auto-key
            if (currentTime >= target.startTime && currentTime < target.endTime && currentTime > 0 && currentTime < target.root.length)
            {
                var localCurrentTime  = currentTime - target.startTime;
                var localPreviousTime = (previousTime - target.startTime) + (target.startTime - lastTargetStartTime);

                localCurrentTime  = Mathf.Clamp(localCurrentTime, 0, targetLength);
                localPreviousTime = Mathf.Clamp(localPreviousTime, 0, targetLength);

#if UNITY_EDITOR
                if (target is IKeyable && localCurrentTime == localPreviousTime)
                {
                    ((IKeyable)target).TryAutoKey(localCurrentTime);
                }
#endif

                target.Update(localCurrentTime, localPreviousTime);
                lastTargetStartTime = target.startTime;
            }

            //root updated callback
            target.RootUpdated(currentTime, previousTime);
        }