Esempio n. 1
0
    void FixedUpdate()
    {
        //Calculates player turning as a float between 1 and -1 (mimicking horizontalAxis)
        turnInput = playerLeftHand.transform.position.y - playerRightHand.transform.position.y;
        if (turnInput > 1)
        {
            turnInput = 1;
        }
        else if (turnInput < -1)
        {
            turnInput = -1;
        }

        //Pauses the game if player makes an X shape with their arms (currently disabled)
        if (playerLeftHand.transform.position.x > playerRightHand.transform.position.x + 0.0175 && Mathf.Abs(playerLeftHand.transform.position.y - playerRightHand.transform.position.y) < 0.05)
        {
            //playerScript.pause();
        }

        //Calls a function in ControlScript to rotate the player based on their input
        playerScript.rotateHorizontal(turnInput);
    }