示例#1
0
    /// <summary>
    /// 滑动屏幕 旋转相机和缩放视野
    /// </summary>
    public void SwipeScreen()
    {
        if (Input.GetMouseButtonDown(0) && !GameDefine.IsPointerOverUIObject(Input.mousePosition))//!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
        {
            oldMousePos  = Vector2.zero;
            isMousePress = true;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            mousePosOffset = Vector2.zero;
            isMousePress   = false;
        }
        if (!isMousePress)
        {
            return;
        }

        newMousePos = Input.mousePosition;
        if (oldMousePos != Vector2.zero)
        {
            mousePosOffset = newMousePos - oldMousePos;
        }
        oldMousePos = newMousePos;
    }