Beispiel #1
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;
        }
    }