private void Update()
        {
            mTouched = JCS_Input.GetMouseButton(0);
            if (mTouched)
            {
                // A ray is an infinite line starting at an origin and going into a direction
                // For this we will use our mouse position
                Ray ray = mCamera.ScreenPointToRay(Input.mousePosition);

                RaycastHit[] hits = Physics.RaycastAll(ray, mRaycastDistance);

                foreach (RaycastHit hit in hits)
                {
                    hit.transform.gameObject.SendMessage("OnMouseDown", SendMessageOptions.DontRequireReceiver);

#if (UNITY_EDITOR)
                    if (JCS_GameSettings.instance.DEBUG_MODE)
                    {
                        // print the name of the detected transform.
                        JCS_Debug.PrintName(hit.transform);
                    }
#endif
                }
            }
        }
Exemplo n.º 2
0
        private void Update()
        {
#if (UNITY_STANDALONE || UNITY_EDITOR)
            mTouched = JCS_Input.GetMouseButton(mMouseType);

            Vector3 currPos = Input.mousePosition;

            // Don't update delta pos when window just focus.
            if (mTouched && !mFocus)
            {
                WhenTouched();
            }
            else
            {
                WhenUntouched();
            }

            mPrePos = currPos;
#elif (UNITY_ANDROID || UNITY_IPHIONE || UNITY_IOS)
            // Detect Touch
            mTouched = (Input.touchCount == mDetectTouchCount);

            if (mTouched)
            {
                WhenTouched();
            }
            else
            {
                WhenUntouched();
                HandleMultiTouches();
            }
#endif
        }