Beispiel #1
0
        public override void Seek(float time)
        {
            base.Seek(time);
            if (_Animator != null && (Application.isPlaying || Preview))
            {
                ResetParameters();
                float updateTime = 0;

                if (Keys != null)
                {
                    if (Index >= 0)
                    {
                        for (int i = 0; i <= Index; i++)
                        {
                            AnimatorKey key     = (AnimatorKey)Keys[i];
                            float       preTime = updateTime;
                            updateTime = key.FireTime;
                            float deltaTime = updateTime - preTime;
                            if (deltaTime > 0)
                            {
                                _Animator.Update(deltaTime);
                            }
                            InitializeEvent(key);
                            if (!key.IsSingleExecution && (updateTime + key.Length >= time))
                            {
                                key.StartEvent();
                                key.UpdateEvent(time);
                            }
                            else
                            {
                                key.FireEvent();
                            }
                        }
                    }
                }
                if (time > updateTime)
                {
                    float deltaTime = (time - updateTime) * 0.5f;
                    _Animator.Update(deltaTime);
                    _Animator.Update(deltaTime);

                    // i don't know why is should update twice to make animator update correctly
                }
            }
        }
Beispiel #2
0
        protected override void InitializeEvent(EventOrientedKey key)
        {
            AnimatorKey aKey = (AnimatorKey)key;

            aKey.Animator = this._Animator;
        }