void Update() { if (!takeInput) { return; } if (Input.GetKey(KeyCode.K) || isLeftButtonHeld) { turnSide = TurnSide.left; } else if (Input.GetKey(KeyCode.L) || isRightButtonHeld) { turnSide = TurnSide.right; } else { turnSide = TurnSide.none; } if (Input.GetKeyDown(KeyCode.Mouse0)) { startMousePosition = Input.mousePosition; } if (Input.GetKeyUp(KeyCode.Mouse0)) { if (Vector2.Distance(startMousePosition, Input.mousePosition) < 10) { doubleTap = true; } } if (Input.GetKeyDown(KeyCode.UpArrow)) { doubleTap = true; } if (Input.touchCount > 0 && Input.GetTouch(0).tapCount > 1) { doubleTap = true; } // to generate new if (Time.timeSinceLevelLoad - lastThrowTime > 0.3f && (doubleTap)) { doubleTap = false; lastThrowTime = Time.timeSinceLevelLoad; attackScript.Shoot(); } // to slide or roll the player if (Input.GetKeyDown(KeyCode.DownArrow)) { RollPlayer(); } //................................... // to Jump the player SpaceBar_Pressed(); //................................. if (Input.GetKeyDown(KeyCode.RightArrow)) { playerScript.RightSideMoving(); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { playerScript.LeftSideMoving(); } // for Swipe Control .......................... if (Input.GetKeyDown(KeyCode.Mouse0) && touchCount == 0) { swipe_Initial_X = Input.mousePosition.x; swipe_Initial_Y = Input.mousePosition.y; touchCount = 1; } if (touchCount == 1) { swipe_Final_X = Input.mousePosition.x; swipe_Final_Y = Input.mousePosition.y; } swipeDirection(); if (Input.GetKeyUp(KeyCode.Mouse0)) { touchCount = 0; } //......................................... }