Пример #1
0
    private void OnDestroy()
    {
        EndTouch();

        onTouchBegin = null;
        onTouchEnd   = null;
        onTouchMove  = null;
    }
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < Input.touches.Length; i++)
     {
         if (Input.touches[i].phase == TouchPhase.Began)
         {
             OnTouchBegin?.Invoke(Input.touches[i]);
             CastAtTouch(Input.touches[i]);
         }
     }
 }
 public virtual void  TouchBegin(Vector2 _touchScreenLocation)
 {
     touchWorldPoint                 = cameraRef.ScreenToWorldPoint(_touchScreenLocation);
     touchScreenCoordinate           = _touchScreenLocation;
     startTouchLocation              = endTouchLocation = _touchScreenLocation;
     _axisValue.x                    = 0;
     _axisValue.y                    = 0;
     touchInfo.touchWorldPoint       = touchWorldPoint;
     touchInfo.touchScreenCoordinate = touchScreenCoordinate;
     touchInfo.endTouchLocation      = endTouchLocation;
     touchInfo.deltaRelease          = deltaRelease;
     touchInfo.touchScreenRatio      = touchScreenRatio;
     OnTouchBegin?.Invoke(touchInfo);
 }
    void OnTapDown(int fingerId, Vector3 tapPosition)
    {
        myRay = mainCamera.ScreenPointToRay(tapPosition);

        if (Physics.Raycast(myRay, out hitInfo, raycastLength, uiLayer, QueryTriggerInteraction.Collide))
        {
            uiScreenPressed = true;
            OnUITouchBegin?.Invoke(fingerId, tapPosition, hitInfo);
        }
        else
        {
            myRay = mainCamera.ScreenPointToRay(tapPosition);
            if (Physics.Raycast(myRay, out hitInfo, raycastLength,
                                Camera.main.cullingMask, QueryTriggerInteraction.Collide))
            {
                OnTouchBegin?.Invoke(fingerId, tapPosition, hitInfo);
            }
            else
            {
                OnTouchBegin?.Invoke(fingerId, tapPosition, new RaycastHit());
            }
        }
    }
Пример #5
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            OnTouchBegin?.Invoke();
        }