/// <summary>
        ///
        /// </summary>
        private void Update()
        {
            if (!registeredSwipeDeltaCallbacks.ContainsKey(gameObject))
            {
                return;
            }

            if (Use.GetFingers().Count > 0)
            {
                TouchCallbackVO touchCallbackVO = new TouchCallbackVO
                {
                    delta          = LeanGesture.GetScreenDelta(Use.GetFingers()),
                    screenPosition = LeanGesture.GetStartScreenCenter(Use.GetFingers())
                };
                registeredSwipeDeltaCallbacks[gameObject].ForEach(i => i?.Invoke(touchCallbackVO));
            }
        }
예제 #2
0
        private void UpdateGesture()
        {
            fingers = Use.GetFingers();

            moveVector = -LeanGesture.GetScreenDelta(fingers);
            if (moveVector != Vector2.zero)
            {
                TouchMove(moveVector);
            }
        }
예제 #3
0
        private void AimTranslate(LeanFinger finger)
        {
            var fingers     = _use.GetFingers();
            var screenDelta = LeanGesture.GetScreenDelta(fingers);

            if (screenDelta != Vector2.zero)
            {
                Translate(screenDelta);
            }
        }
예제 #4
0
    // Update is called once per frame
    void LateUpdate()
    {
        switch (CurrentCameraState)
        {
        case CameraState.CityView:
            //Hold and movein x-y directions
            CommandMoveCamera();
            break;

        case CameraState.PlanetView:

            var fingers = Use.GetFingers(true);
            if (CheckForDoubleTap())
            {
                var targetPos = fingers[0].GetWorldPosition(cameraDistance);
                targetPos.z = 0;
                StartCoroutine(MoveCameraToSelectedPosition(targetPos));
            }

            RotateCameraView(fingers);
            //Swipe Rotate
            //Double tap to zoom to point
            break;

        case CameraState.Zooming:
            ZoomCamera();
            break;

        case CameraState.MovingTo:
            break;

        case CameraState.EventView:
            //From Event

            //Keep the camera looking at an event, follow the event if necessary
            break;
        }
    }
예제 #5
0
        private void UpdateGesture()
        {
            fingers = Use.GetFingers();

            // move camera

            moveVector = -LeanGesture.GetScreenDelta(fingers);
            if (moveVector != Vector2.zero)
            {
                TouchMove(moveVector);
            }

            // pitch zoom
            //UpdateZoom(LeanGesture.GetPinchScale(fingers));
        }
예제 #6
0
    public void ScaleObject()
    {
        List <LeanFinger> fingers = m_use.GetFingers();

        pinchScale = Mathf.Clamp(LeanGesture.GetPinchScale(fingers), 0, 2f);

        if (pinchScale != 1f)
        {
            //update local scale
            transform.localScale *= pinchScale;
            if (transform.localScale.x > maxScale)
            {
                transform.localScale = new Vector3(maxScale, maxScale, maxScale);
            }
            if (transform.localScale.x < minScale)
            {
                transform.localScale = new Vector3(minScale, minScale, minScale);
            }
        }
    }
예제 #7
0
        /**
         * processes the touch movements and
         */
        private void Update()
        {
            var fingers = Use.GetFingers();

            if (fingers.Count > 0)
            {
                var finger = fingers[0];
                if (!newRotationBehaviour)
                {
                    var position  = finger.GetWorldPosition(0, _mainCamera);
                    var direction = transform.position - position;

                    direction.Normalize();

                    var rotationZ = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg - 90f;
                    OnRotationEvent(rotationZ);
                }
                else
                {
                    OnRotationEvent(finger.GetDeltaDegrees(_mainCamera.WorldToScreenPoint(transform.position)));
                }
            }
        }