Ejemplo n.º 1
0
        /// <summary>
        /// Set the camera tween to point and play
        /// </summary>
        public void SetCameraDestination()
        {
            if (moveTween == null)
            {
                return;
            }

            moveTween.values[0] = transform.position;
            moveTween.values[1] = currentSelected.transform.position;
            float distanceToTravel = Vector3.Distance(currentSelected.transform.position, transform.position);

            moveTween.time = Mathf.Max(MIN_TRAVEL_TIME, distanceToTravel / DISTANCE_PER_SECOND);
            //if ( moveTween.enabled == false ) {
            moveTween.CancelTween(TweenBase.TweenCancelType.HardStop);
            moveTween.PlayForwards();

            var rot = moveTween.targetTransform.eulerAngles.y;

            rotationTween.values[0].y = Fix360(rot);
            rotationTween.values[1].y = Fix360(currentSelected.transform.eulerAngles.y);
            //TODO: fix 360 flip
            rotationTween.CancelTween(TweenBase.TweenCancelType.HardStop);
            rotationTween.PlayForwards();
            rotationTween.time = moveTween.time;             //change to degrees per second calculation?...
        }