Exemple #1
0
 /// <summary>
 /// Sets the glocal cursor position to the current x and y position input fields
 /// </summary>
 public void SetGlocalCursorPos()
 {
     if (TryParsePos())
     {
         CursorControl.SetGlobalCursorPos(_pos);
     }
 }
        public void GlobalPosTest()
        {
            Vector2 pos = new Vector2(100, 200);

            CursorControl.SetGlobalCursorPos(pos);
            Assert.AreEqual(pos, CursorControl.GetGlobalCursorPos());
        }
    void NextImage()
    {
        Texture2D texture = Resources.Load <Texture2D>(fileNames[index]);

        index++;
        var sprite = new Sprite();

        sprite                 = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100f);
        image.sprite           = sprite;
        dot.transform.position = wheelGuess;
        CursorControl.SetGlobalCursorPos(wheelGuess);
        lineMode = false;
        line.gameObject.SetActive(false);
    }
Exemple #4
0
    void CheckJoystickInput()
    {
        _x = Input.GetAxis("JoystickMouseX");
        _y = Input.GetAxis("JoystickMouseY");

        if (_x > 0.02 || _x < -0.02 || _y > 0.02 || _y < -0.02)
        {
            float   cursorX      = CursorControl.GetGlobalCursorPos().x;
            float   cursorY      = CursorControl.GetGlobalCursorPos().y;
            float   newX         = cursorX - ((cursorX * _x) / 4);
            float   newY         = cursorY - ((cursorY * _y) / 4);
            Vector2 newCursorPos = new Vector2(newX, newY);
            CursorControl.SetGlobalCursorPos(newCursorPos);
        }
    }
Exemple #5
0
    void FixedUpdate()
    {
        horizontal = Input.GetAxisRaw("Horizontal");
        vertical   = Input.GetAxisRaw("Vertical");
        Vector2 currCursPos = CursorControl.GetGlobalCursorPos();


        Vector2 cursPos = new Vector2(currCursPos.x + horizontal * cursSpeed, currCursPos.y + vertical * cursSpeed * -1.0f);

        if (tel.teleTrigger == true)
        {
            CursorControl.SetGlobalCursorPos(cursPos);

            //cam.transform.position += new Vector3 (horizontal * Time.deltaTime * cursSpeed, vertical * Time.deltaTime * cursSpeed, -10.0f);
        }
    }
    /**
     *  Method to 'teleport' the mouse cursor if it gets stuck on the borders (north, east, south, west)
     *  !not native to Unity! will only work in fullscreen on actuall 1920 / 1080 screen
     *  Dll dependencies (windows only)
     *  left:   0, -
     *  top:    -, 0
     *  right:  1919, -
     *  bottum: -, 1079
     */
    private void continuesMouseIntegration()
    {
        Vector2 currentPosition = CursorControl.GetGlobalCursorPos();
        Vector2 newPosition;

        /** from south to north **/
        if (currentPosition.y <= 5)
        {
            newPosition = new Vector2(currentPosition.x, 1040);
            CursorControl.SetGlobalCursorPos(newPosition);
            resetMousePositions();
        }

        /** from north to south **/
        else if (currentPosition.y >= 1050)
        {
            newPosition = new Vector2(currentPosition.x, 16);
            CursorControl.SetGlobalCursorPos(newPosition);
            resetMousePositions();
        }
        /** from east to west **/
        if (currentPosition.x <= 5)
        {
            newPosition = new Vector2(1790, currentPosition.y);
            CursorControl.SetGlobalCursorPos(newPosition);
            resetMousePositions();
        }

        /** from west to east **/
        else if (currentPosition.x >= 1800)
        {
            newPosition = new Vector2(6, currentPosition.y);
            CursorControl.SetGlobalCursorPos(newPosition);
            resetMousePositions();
        }
    }
 public void TestFixtureTearDown()
 {
     CursorControl.SetGlobalCursorPos(_cursorPos);
 }
 public void SetGlobalCursorPos(Vector2 pos)
 {
     CursorControl.SetGlobalCursorPos(pos);
 }