コード例 #1
0
        public static Touch GetTouch(int id)
        {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
            return(MakefakeTouchOnPc());
#endif
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS || UNITY_WP_8 || UNITY_WP_8_1)
            return(Input.GetTouch(id));
#endif
        }
コード例 #2
0
        int GetAnalogTouchFingerIDInsideArea(int id)
        {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
            return(id);
#endif
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS || UNITY_WP_8 || UNITY_WP_8_1)
            if (id == -1)
            {
                return(-1);
            }

            return(Input.GetTouch(id).fingerId);
#endif
        }
コード例 #3
0
        public static Touch GetTouchByFingerID(int fingerID)
        {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
            return(MakefakeTouchOnPc());
#endif
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS || UNITY_WP_8 || UNITY_WP_8_1)
            for (int i = 0; i < Input.touchCount; i++)
            {
                if (Input.GetTouch(i).fingerId == fingerID)
                {
                    return(Input.GetTouch(i));
                }
            }
            return(new Touch());
#endif
        }
コード例 #4
0
        int GetAnalogFingerIDInsideArea()
        {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
            if ((UnityEngine.Input.GetMouseButtonDown(0) || UnityEngine.Input.GetMouseButtonUp(0) || UnityEngine.Input.GetMouseButton(0)) && IsInsideArea(UnityEngine.Input.mousePosition))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
#endif
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS || UNITY_WP_8 || UNITY_WP_8_1)
            for (int i = 0; i < Input.touchCount; i++)
            {
                if (IsInsideArea(Input.GetTouch(i).position))
                {
                    return(i);
                }
            }
            return(-1);
#endif
        }