Exemplo n.º 1
0
        public override void tick(float totalElapsedTime)
        {
            var easedTime = _easeFunction(totalElapsedTime, 0, 1, _ownerTween.duration);
            var vec       = _path.getPointOnPath(easedTime);

            // if we are relative, add the vec to our startValue
            if (_isRelative)
            {
                vec += _startValue;
            }

            _target.localScale = vec;
        }
Exemplo n.º 2
0
        public override void tick(float totalElapsedTime)
        {
            var easedTime = _easeFunction(totalElapsedTime, 0, 1, _ownerTween.duration);
            var vec       = _path.getPointOnPath(easedTime);

            // if we are relative, add the vec to our startValue
            if (_isRelative)
            {
                vec += _startValue;
            }


            // handle look types
            switch (_lookAtType)
            {
            case GoLookAtType.NextPathNode:
            {
                _smoothedRotation.smoothValue = vec.Equals(_target.position) ? Quaternion.identity : Quaternion.LookRotation(vec - _target.position);
                _target.rotation = _smoothedRotation.smoothValue;
                //var lookAtNode = ( _ownerTween.isReversed || _ownerTween.isLoopoingBackOnPingPong ) ? _path.getPreviousNode() : _path.getNextNode();
                //_target.LookAt( lookAtNode, Vector3.up );
                break;
            }

            case GoLookAtType.TargetTransform:
            {
                _target.LookAt(_lookTarget, Vector3.up);
                break;
            }
            }


            // assign the position
            if (_useLocalPosition)
            {
                _target.localPosition = vec;
            }
            else
            {
                _target.position = vec;
            }
        }