private void OnSwipe(SwipeData data)
 {
     if (isActiveController)
     {
         if (!data.IsEnd)
         {
             if (!IsTransitionStarted)
             {
                 if (!isDragStarted)
                 {
                     isDragStarted = true;
                 }
                 else
                 {
                     DragCurrentTransform(data);
                 }
             }
         }
         else
         {
             if (isDragStarted)
             {
                 isDragStarted = false;
                 var transitionAction = ComputeTransitionAction();
                 Transition(transitionAction);
             }
         }
     }
 }
Ejemplo n.º 2
0
    /**
     * For iterating between elements on the audio cue list.
     */
    public void OnVerticalSwipe(SwipeData swipeData)
    {
        // Only trigger on up/down swipes
        if (swipeData.Direction != SwipeDirection.Down &&
            swipeData.Direction != SwipeDirection.Up)
        {
            return;
        }


        // Update index
        storedAudioInfoElement.Pause();
        audioLibraryIndex += swipeData.Direction == SwipeDirection.Up ? -1 : 1;
        int librarySize = AudioLibrary.instance.library.Length;

        audioLibraryIndex = (audioLibraryIndex + librarySize) % librarySize;

        // Update list and candidate audio cue
        playingAudio = false;
        Audio audio = AudioLibrary.instance.library[audioLibraryIndex];

        storedAudioInfoElement = storedAudioInfoElements[audioLibraryIndex];
        AM.instance.PauseCandidateAudioCueSound();
        AM.instance.ChangeCandidateAudioCueClip(audio);
        HighlightAudioElement(audioCuePanel, audioLibraryIndex, contentPanel);

        // Output current audio cue name
        MM.OutputText(audio.id);
    }
 public void MakeTransitionProgrammatically(ManagementView.SwipeResultAction action)
 {
     if (action == ManagementView.SwipeResultAction.MoveToLeft)
     {
         SwipeData swipeData = new SwipeData()
         {
             Direction     = SwipeDirection.Left,
             EndPosition   = new Vector2(-10, 0),
             StartPosition = new Vector2(0, 0),
             IsEnd         = false
         };
         isDragStarted = false;
         DragCurrentTransform(swipeData);
         Transition(action);
     }
     else if (action == ManagementView.SwipeResultAction.MoveToRight)
     {
         SwipeData swipeData = new SwipeData()
         {
             Direction     = SwipeDirection.Right,
             EndPosition   = new Vector2(0, 0),
             StartPosition = new Vector2(10, 0),
             IsEnd         = false
         };
         isDragStarted = false;
         DragCurrentTransform(swipeData);
         Transition(action);
     }
 }
Ejemplo n.º 4
0
        public void SwipeDetectorHandle(SwipeData data)
        {
            //text.text = "SwipeDetector_OnSwipe";
            int selectedSubScene = GetSelectedScene(data.StartPosition);

            SubScene subscene = GameManager.GetInstance().GetSubScene(selectedSubScene);

            if (subscene == null)
            {
                Debug.Log("subscene not found, check your selectedSubScene index");
                return;
            }
            SceneEventManager eventManager = subscene.GetEventManager();

            if (eventManager == null)
            {
                Debug.Log("eventManager not found in scene");
                return;
            }

            if (data.Direction.Equals(SwipeDirection.Down))
            {
                //eventManager.SwipeDownEvent();
                eventManager.CallEvent(ApplicationConstants.EVENT_IO_SWIPE_DOWN, ActionParams.EmptyParams);
            }

            if (data.Direction.Equals(SwipeDirection.Up))
            {
                //eventManager.SwipeUpEvent();
                eventManager.CallEvent(ApplicationConstants.EVENT_IO_SWIPE_UP, ActionParams.EmptyParams);
                //eventManager.SwipeUpEvent();
                //eventManager.CallEvent("onSwipeUpEvent");
            }
        }
Ejemplo n.º 5
0
    private void SwipeDetector_OnSwipe(SwipeData data)
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (data.directionText == "Left")
        {
            if (sceneName == "Slider_First")
            {
                SceneManager.LoadScene("Slider_Second");
            }
            else if (sceneName == "Slider_Second")
            {
                SceneManager.LoadScene("Slider_Third");
            }
        }
        else if (data.directionText == "Right")
        {
            if (sceneName == "Slider_Second")
            {
                SceneManager.LoadScene("Slider_First");
            }
            else if (sceneName == "Slider_Third")
            {
                SceneManager.LoadScene("Slider_Second");
            }
        }
    }
Ejemplo n.º 6
0
    void HandlePlayerInputFromKeyboard(KeyboardDirection direction)
    {
        SwipeData data = new SwipeData();

        data.Direction = ConvertKeyBoardDirection(direction);
        HandlePlayerSwipe(data);
    }
Ejemplo n.º 7
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     if (logging)
     {
         Debug.Log("Swipe in Direction: " + data.Direction);
     }
 }
    private void TranslateSwipeInput(SwipeData sData)
    {
        switch (sData.Direction)
        {
        case SwipeDirection.Up:
        {
            Jump();
            break;
        }

        case SwipeDirection.Down:
        {
            break;
        }

        case SwipeDirection.Left:
        {
            MoveLeft();
            break;
        }

        case SwipeDirection.Right:
        {
            MoveRight();
            break;
        }
        }
    }
    void CheckMenuMove(SwipeData sData)
    {
        Debug.Log("swip ing");
        if (mainMenuObject.activeSelf)
        {
            if (sData.Direction == SwipeDirection.Right)
            {
                GoToShopMenu();
            }
            if (sData.Direction == SwipeDirection.Left)
            {
                GoToDiceMenu();
            }
        }


        else if (diceMenuObject.activeSelf)
        {
            if (sData.Direction == SwipeDirection.Right)
            {
                GoToMaineMenu();
            }
        }

        else
        {
            if (sData.Direction == SwipeDirection.Left)
            {
                GoToMaineMenu();
            }
        }
    }
Ejemplo n.º 10
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     moveRight    = data.Direcion == SwipeDirection.Right;
     moveLeft     = data.Direcion == SwipeDirection.Left;
     moveForward  = data.Direcion == SwipeDirection.Up;
     moveBackward = data.Direcion == SwipeDirection.Down;
 }
Ejemplo n.º 11
0
    private void SwipeDetector_OnSwipe(SwipeData data)
    {
        Debug.Log("Swipe in Direction: " + data.Direction);
        if (data.Direction == SwipeDirection.Left)
        {
            //2019
            Debug.Log("yeeee it works");
            //particleLauncher.Emit((int)aqi * 20);
            particleLauncher.Emit(1000);

            //particleLauncher1.Emit((int)aqi * 80);
            y19.SetActive(true);
            y20.SetActive(false);
            swipy.SetActive(false);
        }

        if (data.Direction == SwipeDirection.Right)
        {
            //2020
            Debug.Log("yeeee it works");
            particleLauncher.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            particleLauncher1.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            particleLauncher.Emit(600);

            //particleLauncher.Emit((int)aqi);
            //particleLauncher1.Emit((int)aqi);
            y19.SetActive(false);
            y20.SetActive(true);
            swipy.SetActive(false);
        }
    }
Ejemplo n.º 12
0
 private void CutIngredient(SwipeData data)
 {
     Vector3[] positions = new Vector3[2];
     positions[0] = Camera.main.ScreenToWorldPoint(new Vector3(data.StartPosition.x, data.StartPosition.y, zOffset));
     positions[1] = Camera.main.ScreenToWorldPoint(new Vector3(data.EndPosition.x, data.EndPosition.y, zOffset));
     CheckScores(positions[0], positions[1]);
 }
Ejemplo n.º 13
0
    SwipeData CreateSwipe(Vector3 startPos, Vector3 endPos)
    {
        var swipe = new SwipeData();

        PrintSwipeData(swipe);
        return(swipe);
    }
Ejemplo n.º 14
0
    public void InputPlayer(SwipeData data)
    {
        switch (data.Direction)
        {
        case SwipeDirection.Left:
            if (_player._pathId > 0 && _player._canMove)
            {
                _player.transform.position     = _player.transform.position + _player.transform.TransformDirection(Vector3.left - _offset);
                Camera.main.transform.position = Camera.main.transform.position + Camera.main.transform.TransformDirection(Vector3.right + _offset);
                _player._pathId--;
            }
            break;

        case SwipeDirection.Right:
            if (_player._pathId < 2 && _player._canMove)
            {
                _player.transform.position     = _player.transform.position + _player.transform.TransformDirection(Vector3.right + _offset);
                Camera.main.transform.position = Camera.main.transform.position + Camera.main.transform.TransformDirection(Vector3.left - _offset);
                _player._pathId++;
            }
            break;

        case SwipeDirection.Up:
            _player.Jump();
            break;
        }
    }
Ejemplo n.º 15
0
    public static Vector3 GetForceFromSwipeData(SwipeData data)
    {
        var xModifier = (data.StartPosition - data.EndPosition).x / (Screen.width * 1.5f);

        Debug.Log(xModifier);
        return(new Vector3(xModifier, 1, 1) * 3.1f);
    }
Ejemplo n.º 16
0
    private void SwipeDetector_OnSwipe(SwipeData data)
    {
        SwipeDirection direction = data.Direction;

        // swiped right
        directionText.text = "SWIPE DIRECTION: " + direction.ToString() + "\n" + "END POSITION: " + data.EndPosition;
    }
Ejemplo n.º 17
0
 void SwipeDetector_OnSwipe(SwipeData data)
 {
     if (backButtonHeld && data.Direction == SwipeDirection.Up)
     {
         TimetravelUIAnim.SetTrigger("BackButton");
     }
 }
Ejemplo n.º 18
0
 void RussianM(SwipeData data)
 {
     if (data.Direction == SwipeDirection.Up)
     {
         first = true;
         k2++;
     }
     if (data.Direction == SwipeDirection.Down)
     {
         second = true;
         k3++;
     }
     if (data.Direction == SwipeDirection.Up && k2 == 2)
     {
         third = true;
     }
     if (data.Direction == SwipeDirection.Down && k3 == 2)
     {
         fourth = true;
     }
     if (first && second && third && fourth)
     {
         winText.text  = "Правильно";
         winText.color = Color.green;
     }
 }
Ejemplo n.º 19
0
    private void Move(SwipeData data)
    {
        startTime     = Time.time;
        startposition = transform;

        switch (data.Direction)
        {
        case SwipeDirection.Up:
            nextPosition = DetectNextPosition(up);
            break;

        case SwipeDirection.Down:
            nextPosition = DetectNextPosition(down);
            break;

        case SwipeDirection.Left:
            nextPosition = DetectNextPosition(left);
            break;

        case SwipeDirection.Right:
            nextPosition = DetectNextPosition(right);
            break;
        }
        journeyLength = Vector3.Distance(transform.position, nextPosition);
    }
Ejemplo n.º 20
0
    private void SwipeDetector_OnSwipe(SwipeData data)
    {
        Debug.Log("Swipe in Direction: " + data.Direction);
        switch (data.Direction)
        {
        case SwipeDirection.Up:
            Jump();
            break;

        case SwipeDirection.Down:
            Slide();
            break;

        case SwipeDirection.Left:
            Left();
            break;

        case SwipeDirection.Right:
            Right();
            break;

        default:
            Debug.LogWarning("Invalid Swipe!");
            break;
        }
    }
Ejemplo n.º 21
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     if (data.Direction == SwipeDirection.Right || data.Direction == SwipeDirection.Left)
     {
         slider.value += ((data.StartPosition.x - data.EndPosition.x) * 0.01f);
     }
 }
Ejemplo n.º 22
0
    void HandlePlayerPotentialSwipe(SwipeData data)
    {
        //switch (data.Direction) {
        //    case SwipeDirection.Up:
        //        if (HandleUpMovementTest()) {
        //            for (int row = 0; row < MAX_GRID_WIDTH; row++) {
        //                for (int col = 0; col < MAX_GRID_HEIGHT; col++) {
        //                    if (activeCards[row, col].IsCardActive() && col != 0) {
        //                        activeCards[row, col].SetCardActiveState(true);
        //                        activeCards[row, col].transform.DOMove(new Vector2(activeCards[row, col].transform.position.x, activeCards[row, col].transform.position.y + Grid_Spacer_Height / 3), 1);
        //                    }
        //                }
        //            }
        //        }
        //        break;
        //    case SwipeDirection.Right:
        //        if (HandleRightMovementTest()) {

        //        }
        //        break;
        //    case SwipeDirection.Down:
        //        if (HandleDownMovementTest()) {

        //        }
        //        break;
        //    case SwipeDirection.Left:
        //        if (HandleLeftMovementTest()) {

        //        }
        //        break;
        //}
    }
Ejemplo n.º 23
0
    void SwipeDetector_OnSwipe(SwipeData data)
    {
        if (InputOpen)
        {
            StartPos   = transform.position;
            ViableMove = false;
            InputOpen  = false;

            if (data.Direction == SwipeDirection.Up)
            {
                UpMove();
                Jump.Play();
            }

            if (data.Direction == SwipeDirection.Down)
            {
                DownMove();
                Jump.Play();
            }

            if (data.Direction == SwipeDirection.Left)
            {
                LeftMove();
                Jump.Play();
            }

            if (data.Direction == SwipeDirection.Right)
            {
                RightMove();
                Jump.Play();
            }
        }
    }
Ejemplo n.º 24
0
    private void SwipeDetectorOnSwipe(SwipeData data)
    {
        switch (data.Direction.ToString())
        {
        case "Up":
            ballRb.AddForce(-ballDirection * 400.0f);
            break;

        case "Down":
            ballRb.AddForce(ballDirection * 400.0f);
            break;

        case "Left":
            ballDirection = Quaternion.Euler(0, -90, 0) * ballDirection;
            ballRb.AddForce(ballDirection * 50.0f);
            camera.ChangeAngle(-90);
            break;

        case "Right":
            ballDirection = Quaternion.Euler(0, 90, 0) * ballDirection;
            ballRb.AddForce(ballDirection * 50.0f);
            camera.ChangeAngle(90);
            break;
        }
    }
Ejemplo n.º 25
0
    private void SwipeDetector_OnSwipe(SwipeData data)
    {
        //thisthing.SetActive(true);
        //thisthing.SetActive(false);
        bool IsActive = thisthing.activeSelf;

        thisthing.SetActive(!IsActive);
    }
Ejemplo n.º 26
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     Vector3[] positions = new Vector3[2];
     positions[0] = Camera.main.ScreenToWorldPoint(new Vector3(data.fingerDownPosition.x, data.fingerDownPosition.y, zOffset));
     positions[1] = Camera.main.ScreenToWorldPoint(new Vector3(data.fingerUpPosition.x, data.fingerUpPosition.y, zOffset));
     lineRenderer.positionCount = 2;
     lineRenderer.SetPositions(positions);
 }
Ejemplo n.º 27
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     Debug.Log("Swipe in Direction: " + data.Direction);
     if (data.Direction == SwipeDirection.Right)
     {
         Debug.Log("yeeee it works");
     }
 }
Ejemplo n.º 28
0
 private void SwipeDetect_OnSwipe(SwipeData data)
 {
     if (this.tag == "Feeling")
     {
         gameController.AddSymptom();
         this.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 29
0
 private void SwipeDetector_OnSwipe(SwipeData data)
 {
     Vector3[] positions = new Vector3[2];
     positions[0] = cam.ScreenToWorldPoint(new Vector3(data.StartPosition.x, data.StartPosition.y, zOffset));
     positions[1] = cam.ScreenToWorldPoint(new Vector3(data.EndPosition.x, data.EndPosition.y, zOffset));
     lineRenderer.positionCount = 2;
     lineRenderer.SetPositions(positions);
 }
 private void SwipeDetector_OnSwipe(SwipeData data)          //Set the positions converted from screen point to worldPoint (The positions that we can give to our line renderer)
 {
     Vector3[] positions = new Vector3[2];
     positions[0] = Camera.main.ScreenToWorldPoint(new Vector3(data.StartPosition.x, data.StartPosition.y, zOffset));
     positions[1] = Camera.main.ScreenToWorldPoint(new Vector3(data.EndPosition.x, data.EndPosition.y, zOffset));
     lineRenderer.positionCount = 2;
     lineRenderer.SetPositions(positions);
 }