示例#1
0
    public void ZoomOut()
    {
        if (!IsZoomed || !IsZoomInPlace)
        {
            return;
        }

        IsZoomed      = false;
        IsZoomInPlace = false;

        GameController.Instance.Unpause();

        foreach (GameObject cardGameObject in cardGameObjects)
        {
            LerpInformation <Vector3> positionLerpInformation = new LerpInformation <Vector3>(
                cardGameObject.transform.position, positionsBeforeZoom[cardGameObject],
                ZoomLerpDuration, Vector3.Lerp);
            zoomMovementLerpInformations[cardGameObject] = positionLerpInformation;

            LerpInformation <Quaternion> rotationLerpInformation = new LerpInformation <Quaternion>(
                cardGameObject.transform.rotation, rotationsBeforeZoom[cardGameObject],
                ZoomLerpDuration, Quaternion.Lerp);
            zoomRotationLerpInformations[cardGameObject] = rotationLerpInformation;
        }

        zoomScaleLperInformation = new LerpInformation <Vector3>(transform.localScale, new Vector3(0.5f, 0.5f, 1),
                                                                 ZoomLerpDuration, Vector3.Lerp);

        ZoomedOut?.Invoke(this, new CardStackEventArgs(this));
    }
示例#2
0
 void ChangeButtonStatesAfterAnimationCompleted()
 {
     if (currentTransitionType == TransitionType.Forward || currentTransitionType == TransitionType.Backward || currentTransitionType == TransitionType.Inward)
     {
         DefaultState?.Invoke();
     }
     else if (currentTransitionType == TransitionType.Outward)
     {
         ZoomedOut?.Invoke();
     }
 }
    void FinishTransitioning()
    {
        transitioning = false;
        focused       = !focused;
        lerpPct       = 0;

        if (focused)
        {
            ZoomedIn?.Invoke();
        }
        else
        {
            ZoomedOut?.Invoke();
        }
    }
        private IEnumerator MoveCamera()
        {
            float delta = 0.2f;

            bool isFirstBlockOnScreen = false;
            bool isLastBlockOnScreen  = false;

            while (!isFirstBlockOnScreen || !isLastBlockOnScreen)
            {
                Vector3 screenPointFirst = Camera.main.WorldToViewportPoint(_startBlock.position);
                isFirstBlockOnScreen = screenPointFirst.z > 0 && screenPointFirst.x > 0 && screenPointFirst.x < 1 && screenPointFirst.y > 0 && screenPointFirst.y < 1;

                Vector3 screenPointLast = Camera.main.WorldToViewportPoint(_lastBlock.position);
                isLastBlockOnScreen = screenPointLast.z > 0 && screenPointLast.x > 0 && screenPointLast.x < 1 && screenPointLast.y > 0 && screenPointLast.y < 1;

                Camera.main.orthographicSize += delta;

                yield return(null);
            }

            yield return(new WaitForSeconds(0.5f));

            onZoomedOut?.Invoke();
        }