Пример #1
0
    public void swipes()
    {
        Vector2 distance = end_pos - start_pos;

        if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
        {
            //Debug.Log("horizontal.swip");
            if (distance.x > 0)
            {
                //Debug.Log("right.swip");
                swipe_dir = swipe_direction.right;
            }
            if (distance.x < 0)
            {
                //Debug.Log("left.swip");
                swipe_dir = swipe_direction.left;
            }
        }

        if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
        {
            ///Debug.Log("vertical.swip");
            if (distance.y > 0)
            {
                //Debug.Log("up.swip");
                swipe_dir = swipe_direction.up;
            }
            if (distance.y < 0)
            {
                //Debug.Log("down.swip");
                swipe_dir = swipe_direction.down;
            }
        }
    }
Пример #2
0
 void Start()
 {
     swipe_dir = swipe_direction.none;
 }