Esempio n. 1
0
        // JoyMouseManagment
        private void JoyMouseManagment( UMJ_Joystick Joystick )
        {
            if( Joystick.CheckPosition( Input.mousePosition ) && Input.GetMouseButtonDown( 0 ) )
            {
                Joystick.TouchDown = true;
                Joystick.GetDefaultPosition( Input.mousePosition );
            }

            if( Joystick.TouchDown && Input.GetMouseButton( 0 ) ) Joystick.GetCurrentPosition( Input.mousePosition );

            if( Input.GetMouseButtonUp( 0 ) ) Joystick.ResetJoystickPosition();
        }
Esempio n. 2
0
        // JoyTouchManagment
        private void JoyTouchManagment( Touch touch, UMJ_Joystick Joystick )
        {
            switch( touch.phase )
            {
                case TouchPhase.Began:

                    if( Joystick.CheckPosition( touch.position ) && !Joystick.TouchDown )
                    {
                        Joystick.TouchID = touch.fingerId;
                        Joystick.TouchDown = true;
                        Joystick.GetDefaultPosition( touch.position );
                    }

                    break;

                case TouchPhase.Stationary:
                case TouchPhase.Moved:

                    if( Joystick.TouchID == touch.fingerId && Joystick.TouchDown )
                    {
                        Joystick.GetCurrentPosition( touch.position );
                    }

                    break;

                case TouchPhase.Ended:
                case TouchPhase.Canceled:

                    if( Joystick.TouchID == touch.fingerId )
                    {
                        Joystick.ResetJoystickPosition();
                    }

                    break;
            }
        }