RotationTweenProperty.prepareForUse C# (CSharp) Method

prepareForUse() public method

public prepareForUse ( ) : void
return void
    public override void prepareForUse()
    {
        _target = _ownerTween.target as Transform;

        _endValue = _originalEndValue;

        // if this is a from tween we need to swap the start and end values
        if( _ownerTween.isFrom )
        {
            _startValue = _endValue;

            if( _useLocalRotation )
                _endValue = _target.localRotation.eulerAngles;
            else
                _endValue = _target.rotation.eulerAngles;
        }
        else
        {
            if( _useLocalRotation )
                _startValue = _target.localRotation.eulerAngles;
            else
                _startValue = _target.rotation.eulerAngles;
        }

        // handle rotation carefully: when not relative, we always want to go the shortest possible distance to the new angle
        if( _isRelative && !_ownerTween.isFrom )
            _diffValue = _startValue + _endValue;
        else
            _diffValue = new Vector3( Mathf.DeltaAngle( _startValue.x, _endValue.x ), Mathf.DeltaAngle( _startValue.y, _endValue.y ), Mathf.DeltaAngle( _startValue.z, _endValue.z ) );
    }