예제 #1
0
    private void _HandleSwipes()
    {
        Swipe   resultGesture = Swipe.None;
        Vector2 resultDelta   = new Vector2(0, 0);

        if (Input.touchCount == 0 && isGestureGoing)
        {
            isGestureGoing = false;
            resultGesture  = Swipe.Ending;
        }
        if (Input.touchCount == 1)
        {
            resultDelta = Input.GetTouch(0).deltaPosition;

            if (resultDelta.sqrMagnitude < minSwipeDeltapos)
            {
                resultDelta = new Vector2(0, 0);
            }
            else
            {
                if (Mathf.Abs(resultDelta.x) > Mathf.Abs(resultDelta.y))
                {
                    resultGesture = resultDelta.x < 0 ? Swipe.Left : Swipe.Right;
                }
                else
                {
                    resultGesture = resultDelta.y < 0 ? Swipe.Down : Swipe.Up;
                }
            }
            if (TutorialSwipes.IsTutorialEnabled())
            {
                resultDelta.x = (resultGesture == Swipe.Up || resultGesture == Swipe.Down) ? 0 : resultDelta.x;
                resultDelta.y = (resultGesture == Swipe.Left || resultGesture == Swipe.Right) ? 0 : resultDelta.y;
            }
        }
        if (resultGesture != Swipe.None && _IsActionPermited(resultGesture))
        {
            isGestureGoing = (resultGesture != Swipe.Ending);
            _NotifyAboutSwipe(resultGesture, resultDelta);
        }
    }
예제 #2
0
    void Start()
    {
        planetInfoScreen     = GameObject.Find("PlanetInfoUI").GetComponent <UIDocument>().rootVisualElement;
        swipeTutorial        = GameObject.Find("SwipesTutorial").GetComponent <TutorialSwipes>();
        tappingTutorial      = GameObject.Find("TappingTutorial").GetComponent <TapOnObjectTutorial>();
        zoomTutorial         = GameObject.Find("ZoomTutorial").GetComponent <TutorialZoom>();
        rotationTutorial     = GameObject.Find("RotationTutorial").GetComponent <RotationTutorial>();
        doubleTapTutorial    = GameObject.Find("DoubleTapTutorial").GetComponent <TutorialDoubleTap>();
        saveManager          = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <SaveManager>();
        tutorialCompleteText = GameObject.Find("TutorialCompleteText");
        tappingTarget        = GameObject.Find("Settings");
        sovleButton          = GameObject.Find("SolveButton");
        sovleButton.SetActive(false);

        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>();

        var color = Color.white;

        color.a = 0;
        tutorialCompleteText.GetComponent <TextMeshProUGUI>().color = color;
        tutorialCompleteText.SetActive(false);

        eventOnClick = ev => { StartNextStep(); };
    }