public void EnableGridMode(Vector3 position)
        {
            if (state == State.Grid)
            {
                return;
            }

            if (state != State.Zoomed)
            {
                var lookDirection = Camera.main.transform.position - transform.parent.position;
                currentRotationToCamera = Quaternion.LookRotation(lookDirection, Vector3.up).eulerAngles.y % 360;

                gridKeyFrame.LocalRotation = new Vector3(0, currentRotationToCamera, 0);
                gridKeyFrame.LocalScale    = TransformsHelper.WorldToLocalScale(transform, gridWorldScale);
                gridKeyFrame.LocalPosition = position;
            }
            else
            {
                gridKeyFrame.LocalRotation = new Vector3(0, currentRotationToCamera, 0);
            }

            presenterGridKeyFrame.LocalPosition = Vector3.zero;
            presenterGridKeyFrame.LocalRotation = Constants.PlaneRotationCorrection;

            animationExecutor.StartAnimation(gridKeyFrame, Constants.TransitionDuration);
            presenterAnimationExecutor.StartAnimation(presenterGridKeyFrame,
                                                      Constants.TransitionDuration,
                                                      animateRotation: false,
                                                      animateScale: false);

            state = State.Grid;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resizes the GameObject to fit the given image.
        /// </summary>
        private void UpdateImageSize(Texture2D image)
        {
            float imageWidth  = image.width;
            float imageHeight = image.height;

            ImageUtils.LimitImageDimensionsTo(
                maxWidth,
                maxHeight,
                ref imageWidth,
                ref imageHeight);

            var newScale = new Vector3(imageWidth, 1f, imageHeight);

            KeyFrame keyFrame;

            keyFrame.LocalScale    = newScale;
            keyFrame.LocalPosition = gameObject.transform.localPosition;
            keyFrame.LocalRotation = gameObject.transform.localRotation.eulerAngles;

            animationExecutor.StartAnimation(keyFrame, Constants.TransitionDuration);
        }
 public void EnableNavigatorButton()
 {
     MaterialsHelper.ChangeMaterial(ArrowGameObject.transform, EnabledMaterial, Constants.FrontMaterialIndex);
     animationExecutor.StartAnimation(shownKeyFrame, Constants.ClickAnimationDuration);
     isEnabled = true;
 }