/*--------------------------------------------------------- Functions ------------------------------------------------------------ */ ///Perform action based on touch input. private void PerformAction(InputManager.SwipeDirections direction) { if (direction == InputManager.SwipeDirections.Tap) { Debug.Log("Tap"); } if (direction == InputManager.SwipeDirections.Left) { Debug.Log("Left"); //Debug.Log(Screen.width + "; Lane: " + currentLevel.LaneWidth()); if (curLane > 1) { if (!isKnockback) { StopAllCoroutines(); curLane--; StartCoroutine(Move(currentLevel.lanes[curLane - 1].pos)); } //player.transform.position = new Vector3(currentLevel.lanes[curLane-1].pos.x, player.transform.position.y, player.transform.position.z); } } else if (direction == InputManager.SwipeDirections.Right) { Debug.Log("Right"); //Debug.Log(Screen.width + "; Lane: " + currentLevel.LaneWidth()); if (curLane < currentLevel.lanes.Length) { if (!isKnockback) { StopAllCoroutines(); curLane++; StartCoroutine(Move(currentLevel.lanes[curLane - 1].pos)); } //player.transform.position = new Vector3(currentLevel.lanes[curLane-1].pos.x, player.transform.position.y, player.transform.position.z); } } else if (direction == InputManager.SwipeDirections.Up) { //Use character skill. Debug.Log("Use skill"); } else if (direction == InputManager.SwipeDirections.Down) { //Use character ultimate arts. Debug.Log("Unleashed ultimate arts!"); } }
/*--------------------------------------------------------- Functions ------------------------------------------------------------ */ ///Upon touch detection, get touch input information from input manager. public void OnTouchDetection(object source, InputManager.SwipeDirections input) { PerformAction(input); }