Exemplo n.º 1
0
        internal void _SetSequence(Sequence seq, float toPos)
        {
            Shape shape = _shapeInstance.GetShape();

            Assert.Fatal(shape != null && toPos >= 0.0f && toPos <= 1.0f, "Thread.SetSequence - Invalid shape handle, sequence number, or position.");

            _shapeInstance.ClearTransition(this);

            _sequence = seq;
            _priority = _sequence.Priority;
            _pos = toPos;
            _makePath = _sequence.MakePath();

            // 1.0f doesn't exist on cyclic sequences
            if (_pos > 0.9999f && _sequence.IsCyclic())
                _pos = 0.9999f;

            // select keyframes
            _SelectKeyframes(_pos, _sequence, out _keyNum1, out _keyNum2, out _keyPos);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets a new sequence on the thread by transitioning to it.
        /// </summary>
        /// <param name="seq">The sequence to transition to.</param>
        /// <param name="toPos">The position of the new sequence to start at.</param>
        /// <param name="duration">The length of the transition.</param>
        /// <param name="continuePlay">Whether or not to continue playing the thread.</param>
        public void TransitionToSequence(Sequence seq, float toPos, float duration, bool continuePlay)
        {
            Assert.Fatal(duration > 0.0f, "Thread.TransitionToSequence - Must pass a positive non zero duration.");

            Shape shape = _shapeInstance.GetShape();

            // make sure these nodes are smoothly interpolated to new positions...
            // basically, any node we controlled just prior to transition, or at any stage
            // of the transition is interpolated.  If we _start to transtion from A to B,
            // but before reaching B we transtion to C, we Interpolate all nodes controlled
            // by A, B, or C to their new position.
            if (_transitionData._inTransition)
            {
                _transitionData._oldRotationNodes.Overlap(_sequence.DoesRotationMatter);
                _transitionData._oldTranslationNodes.Overlap(_sequence.DoesTranslationMatter);
                _transitionData._oldScaleNodes.Overlap(_sequence.DoesScaleMatter);
            }
            else
            {
                _transitionData._oldRotationNodes.Copy(ref _sequence.DoesRotationMatter);
                _transitionData._oldTranslationNodes.Copy(ref _sequence.DoesTranslationMatter);
                _transitionData._oldScaleNodes.Copy(ref _sequence.DoesScaleMatter);
            }

            // Set time characteristics of transition
            _transitionData._oldSequence = _sequence;
            _transitionData._oldPos = _pos;
            _transitionData._duration = duration;
            _transitionData._pos = 0.0f;
            _transitionData._direction = _timeScale > 0.0f ? 1.0f : -1.0f;
            _transitionData._targetScale = continuePlay ? 1.0f : 0.0f;

            // in transition...
            _transitionData._inTransition = true;

            // Set target _sequence data
            _sequence = seq;
            _priority = _sequence.Priority;
            _pos = toPos;
            _makePath = _sequence.MakePath();

            // 1.0f doesn't exist on cyclic sequences
            if (_pos > 0.9999f && _sequence.IsCyclic())
                _pos = 0.9999f;

            // select keyframes
            _SelectKeyframes(_pos, _sequence, out _keyNum1, out _keyNum2, out _keyPos);
        }