private void HandleSwipe(TouchController.SwipeDirection swipeDir) { //OnSwipeChangedMethod(swipeDir); if (isRolling == true) { EndRoll(); } switch (swipeDir) { case TouchController.SwipeDirection.Up: GameGlobals.Instance.audioController.stopSound("PlayerDuck", false); doJump(); break; case TouchController.SwipeDirection.Down: doRoll(); break; case TouchController.SwipeDirection.Left: GameGlobals.Instance.audioController.stopSound("PlayerDuck", false); doChangeLane(-1, laneChangeTime); break; case TouchController.SwipeDirection.Right: GameGlobals.Instance.audioController.stopSound("PlayerDuck", false); doChangeLane(1, laneChangeTime); break; } }
private void UpdateControls() { // Swipe Controls TouchController.SwipeDirection direction = GameGlobals.Instance.touchController.getSwipeDirection(); //get the swipe direction if (direction != TouchController.SwipeDirection.Null) { if (direction == TouchController.SwipeDirection.Up) { HandleSwipe(TouchController.SwipeDirection.Up); } if (direction == TouchController.SwipeDirection.Down) { HandleSwipe(TouchController.SwipeDirection.Down); } if (direction == TouchController.SwipeDirection.Left) { HandleSwipe(TouchController.SwipeDirection.Left); } if (direction == TouchController.SwipeDirection.Right) { HandleSwipe(TouchController.SwipeDirection.Right); } } // Keyboard Controls if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))//Up/ jump { HandleSwipe(TouchController.SwipeDirection.Up); } else if ((Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))) { HandleSwipe(TouchController.SwipeDirection.Down); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))//Left { HandleSwipe(TouchController.SwipeDirection.Right); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))//Right { HandleSwipe(TouchController.SwipeDirection.Left); } if (Input.GetButtonDown("Fire1")) { CharacterObstacle.onClick(player.transform.position); } }
private void UpdateControls() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow) || OVRInput.Get(OVRInput.Button.Up))//Up { HandleSwipe("UP"); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow) || OVRInput.Get(OVRInput.Button.Down))// jump { HandleSwipe("Down"); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) || OVRInput.Get(OVRInput.Button.Right))//Left { HandleSwipe("Right"); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow) || OVRInput.Get(OVRInput.Button.Left))//Right { HandleSwipe("Left"); } TouchController.SwipeDirection direction = GameGlobals.touchController.getSwipeDirection(); if (direction != TouchController.SwipeDirection.Null) { if (direction == TouchController.SwipeDirection.Up) { HandleSwipe("UP"); } if (direction == TouchController.SwipeDirection.Down) { HandleSwipe("Down"); } if (direction == TouchController.SwipeDirection.Right) { HandleSwipe("Right"); } if (direction == TouchController.SwipeDirection.Left) { HandleSwipe("Left"); } } //DetectSwipe(); }
private void onSwipeChanged(TouchController.SwipeDirection swipe) { switch (swipe) { case TouchController.SwipeDirection.Up: HandleSwipe(TouchController.SwipeDirection.Up); break; case TouchController.SwipeDirection.Down: HandleSwipe(TouchController.SwipeDirection.Down); break; case TouchController.SwipeDirection.Right: HandleSwipe(TouchController.SwipeDirection.Right); break; case TouchController.SwipeDirection.Left: HandleSwipe(TouchController.SwipeDirection.Left); break; } }